刚接触axis,老大给了一个类,自己按照这个类,在本地上写了一个java的webservice接口,然后用下面程序调用是可以的,但是,换成.net提供的接口就有问题。
麻烦大家帮下忙!
代码:
public class getWebService {
public static void main(String args[]){
EndpointReference targetEPR = new EndpointReference("http://59.41.9.39:8088/BYQDataExchange/WebService1.asmx");
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setTimeOutInMilliSeconds(600000);
try
{
ServiceClient serviceClient = new ServiceClient();
serviceClient.setOptions(options);
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("WebService1", ""); //命名空间
OMElement method = fac.createOMElement("HelloWorld", omNs);//方法名
OMElement result = serviceClient.sendReceive(method);
String response2 = result.getFirstElement().getText();
System.out.println(response2);
}catch(Exception e){
e.printStackTrace();
}
}
}
=====================================================
错误信息:
rg.apache.axis2.AxisFault: Server did not recognize the value of HTTP Header SOAPAction: urn:anonOutInOp.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:517)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:539)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
at getWebService.main(getWebService.java:39)
请问此问题解决了么?