Using Axis2 1.3, I have written the following sample client code that calls a
remote webservice for currency conversion - it throws the exception:
AxisFault: The anonOutInOp operation cannot be found.
at
org.apache.axis2.client.ServiceClient.createClient(ServiceClient.java:642)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:526)
at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
/* 1 */ ServiceClient svcClient = new ServiceClient(null, new
URL("http://www.webserviceX.net/CurrencyConvertor.asmx?wsdl"),
new QName("http://www.webserviceX.NET/","CurrencyConvertor"),
"CurrencyConvertorSoap";);
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace ns = fac.createOMNamespace("http://www.webserviceX.NET/", "ns1");
OMElement payload = fac.createOMElement("ConversionRate", ns);
OMElement fromValue = fac.createOMElement("FromCurrency", ns);
fromValue.setText("USD");
payload.addChild(fromValue);
OMElement toValue = fac.createOMElement("ToCurrency", ns);
toValue.setText("INR");
payload.addChild(toValue);
OMElement responseElem=svcClient.sendReceive(payload);
The client works when I replace the dynamic service client creation by a normal
creation (new ServiceClient()) without any args and set Options object into it
i.e. replacing line marked /* 1 */ above with the following works:
svcClient = new ServiceClient();
Options opts = new Options();
opts.setTo(new
EndpointReference("http://www.webserviceX.net/CurrencyConvertor.asmx"));
opts.setAction("http://www.webserviceX.NET/ConversionRate");
svcClient.setOptions(opts);
The first code worked in Axis1. Is something wrong in it or will it not work
due to changes in Axis2?