Expand|Select|Wrap|Line Numbers
- import java.nio.charset.Charset;
- import java.rmi.RemoteException;
- import javax.xml.namespace.QName;
- import javax.xml.rpc.ParameterMode;
- import javax.xml.rpc.ServiceException;
- import org.apache.axis.client.Call;
- import org.apache.axis.client.Service;
- import org.apache.axis.encoding.XMLType;
- public class StartUpClient {
- public static void main(String[] args)
- {
- try{
- String endpoint = "http://localhost:8686/wscplus?wsdl";
- Service service = new Service();
- Call call = (Call)service.createCall();
- call.setTargetEndpointAddress(endpoint);
- call.setOperationName(new QName("urn:wscplus","helloservice"));
- call.addParameter("param", XMLType.XSD_STRING, ParameterMode.IN);
- call.addParameter("result", XMLType.XSD_STRING, ParameterMode.OUT);
- call.setReturnTypeAsHeader(XMLType.XSD_STRING);
- String str = "237adsfasdfsdf";
- String strParam = new String(str.getBytes(Charset.forName("UTF-8")));
- String result = (String)call.invoke(new Object[]{strParam});
- System.out.println("Get return result from c++ server" + result);
- }
- catch(ServiceException e)
- {
- e.printStackTrace();
- }
- catch(RemoteException e)
- {
- e.printStackTrace();
- }
- }
- }
When I start the client after starting the serverside,it always report the error "Method 'ns1:helloservice' not implemented: method name or namespace not recognized", can you help me find the solution? Thanks a lot!