"No such operation" Error in axis webservice
I'm developing an axis java web service with two methods, both have an custom Object as parameter and a custom object as return value. I have them defined in the wsdd as:
<service name="MyService" provider="java:RPC" style="document" use="literal">
<parameter name="className" value="com.mycompany.webservice.MyService"/>
<parameter name="allowedMethods" value="*"/>
<parameter name="scope" value="Application"/>
<beanMapping qname="ns:GetDataRequest" xmlns:ns="GetDataRequest" languageSpecificType="java:com.mycompany.bo.webservice.request.GetDataRequest"/>
<beanMapping qname="ns:AuthenticateRequest" xmlns:ns="AuthenticateRequest" languageSpecificType="java:com.mycompany.bo.webservice.request.AuthenticateRequest"/>
<beanMapping qname="ns:GetData" xmlns:ns="GetData" languageSpecificType="java:com.mycompany.bo.webservice.response.GetData"/>
<beanMapping qname="ns:Authenticate" xmlns:ns="Authenticate" languageSpecificType="java:com.mycompany.bo.webservice.response.Authenticate"/>
<namespace>http://com.mycompany.webservice</namespace>
</service>
When I execute in a client the "Authenticate" method everything works perfect. But when I execute from the client the "GetData" , I'm getting "No such operation" any idea on what's going on?
I've tried both methods with the same parameters in the server and everything goes well. Thanks
UPDATE: I've tried changing the service style /use from document/literal to wrapped and now i'm getting the same error on both methods
UPDATE: The generated wsdl is:
<?x开发者_如何学Pythonml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://com.mycompany.webservice" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://com.mycompany.webservice" xmlns:intf="http://com.mycompany.webservice" xmlns:tns1="AuthenticateRequest" xmlns:tns2="Authenticate" xmlns:tns3="http://response.webservice.bo.myCompany.com" xmlns:tns4="GetDataRequest" xmlns:tns5="GetData" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="AuthenticateRequest" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="Authenticate"/>
<import namespace="GetDataRequest"/>
<import namespace="GetData"/>
<import namespace="http://response.webservice.bo.myCompany.com"/>
<complexType name="AuthenticateRequest">
<sequence>
<element name="contra" nillable="true" type="xsd:string"/>
<element name="user" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://com.mycompany.webservice" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="Authenticate"/>
<import namespace="GetDataRequest"/>
<import namespace="GetData"/>
<import namespace="http://response.webservice.bo.myCompany.com"/>
<import namespace="AuthenticateRequest"/>
<element name="peticion" type="tns1:AuthenticateRequest"/>
<element name="authenticateReturn" type="tns2:Authenticate"/>
<element name="peticion1" type="tns4:GetDataRequest"/>
<element name="getDataReturn" type="tns5:GetData"/>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://response.webservice.bo.myCompany.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="Authenticate"/>
<import namespace="GetDataRequest"/>
<import namespace="GetData"/>
<import namespace="AuthenticateRequest"/>
<complexType name="WSResponse">
<sequence>
<element name="codigo" nillable="true" type="xsd:string"/>
<element name="comentario" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="Authenticate" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="GetDataRequest"/>
<import namespace="GetData"/>
<import namespace="http://response.webservice.bo.myCompany.com"/>
<import namespace="AuthenticateRequest"/>
<complexType name="Authenticate">
<complexContent>
<extension base="tns3:WSResponse">
<sequence>
<element name="idSession" nillable="true" type="xsd:string"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="GetDataRequest" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="Authenticate"/>
<import namespace="GetData"/>
<import namespace="http://response.webservice.bo.myCompany.com"/>
<import namespace="AuthenticateRequest"/>
<complexType name="GetDataRequest">
<sequence>
<element name="idSession" nillable="true" type="xsd:string"/>
<element name="poblacion" nillable="true" type="xsd:string"/>
<element name="provincia" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
<schema elementFormDefault="qualified" targetNamespace="GetData" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="Authenticate"/>
<import namespace="GetDataRequest"/>
<import namespace="http://response.webservice.bo.myCompany.com"/>
<import namespace="AuthenticateRequest"/>
<complexType name="GetData">
<complexContent>
<extension base="tns3:WSResponse">
<sequence>
<element name="provincia" nillable="true" type="xsd:string"/>
<element name="poblacion" nillable="true" type="xsd:string"/>
<element name="cp" nillable="true" type="xsd:string"/>
<element name="dato" type="xsd:double"/>
<element name="cuantos" type="xsd:int"/>
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
</wsdl:types>
<wsdl:message name="getDataResponse">
<wsdl:part element="impl:getDataReturn" name="getDataReturn"/>
</wsdl:message>
<wsdl:message name="authenticateRequest">
<wsdl:part element="impl:peticion" name="peticion"/>
</wsdl:message>
<wsdl:message name="getDataRequest">
<wsdl:part element="impl:peticion1" name="peticion"/>
</wsdl:message>
<wsdl:message name="authenticateResponse">
<wsdl:part element="impl:authenticateReturn" name="authenticateReturn"/>
</wsdl:message>
<wsdl:portType name="MyService">
<wsdl:operation name="authenticate" parameterOrder="peticion">
<wsdl:input message="impl:authenticateRequest" name="authenticateRequest"/>
<wsdl:output message="impl:authenticateResponse" name="authenticateResponse"/>
</wsdl:operation>
<wsdl:operation name="getData" parameterOrder="peticion">
<wsdl:input message="impl:getDataRequest" name="getDataRequest"/>
<wsdl:output message="impl:getDataResponse" name="getDataResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyServiceSoapBinding" type="impl:MyService">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="authenticate">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="authenticateRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="authenticateResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getData">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getDataRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="getDataResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyServiceService">
<wsdl:port binding="impl:MyServiceSoapBinding" name="MyService">
<wsdlsoap:address location="http://www.localhost.com:8080/myWS/services/MyService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
The error code is:
No such operation 'peticion1'
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2938)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
javax.xml.parsers.SAXParser.parse(SAXParser.java:395)
org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:796)
org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
org.apache.axis.client.Call.invokeEngine(Call.java:2784)
org.apache.axis.client.Call.invoke(Call.java:2767)
org.apache.axis.client.Call.invoke(Call.java:2443)
org.apache.axis.client.Call.invoke(Call.java:2366)
org.apache.axis.client.Call.invoke(Call.java:1812)
example.MyServiceSoapBindingStub.getData(MyServiceSoapBindingStub.java:230)
I've seen the problem in a lot of other forums and no responses at all. It seems to be a problem in Axis 1.x so finally i'm changing to another SOAP stack (Axis2 in my case). And everything is working.
Well, i hope that not be so late to answer to this topic, i faced this error some hours ago, and results that if you generate a Java client for axis, for example with eclipse. This generate several clases, in that clases is generated a *BindingStub; in this class is created a method called "createCall()", this method is quite important, because here is auto-generated the code that sets the type mapping to the call, and with this Axis knows to mapping the request parameters from the client to the service.
I've implemented this logic to the Request Parameter of type Array. And the error has gone.
Service service = new Service();
Call _call = (Call) service.createCall();
//
synchronized (this) {
Class<?> clazz = co.development.portals.ws.model.PointSoap[].class;
QName arrayQName = new QName(
"urn:http.service.ws.portals.development.co",
"ArrayOf_tns2_PointSoap"),
objectQName = new QName(
"http://model.ws.portals.development.co",
"PointSoap");;
SerializerFactory serializerFactory = (SerializerFactory)
new ArraySerializerFactory(objectQName, null);
DeserializerFactory deserializerFactory = (DeserializerFactory)
new ArrayDeserializerFactory();
_call.registerTypeMapping(
clazz,
arrayQName,
serializerFactory,
deserializerFactory,
false);
} ..... Other stuff like setting Endpoint, operation, returnType and so on to the _call object.
Indeed, my service receive an PointSoap Array.
Note: sorry for my English Jejeje.
Best Regards, Harvey
精彩评论