“没有这样的操作"轴网络服务中的错误 [英] "No such operation" Error in axis webservice

查看:27
本文介绍了“没有这样的操作"轴网络服务中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用两种方法开发轴 Java Web 服务,它们都有一个自定义对象作为参数,一个自定义对象作为返回值.我在 wsdd 中将它们定义为:

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>

当我在客户端中执行身份验证"方法时,一切正常.但是当我从客户端执行GetData"时,我得到没有这样的操作"关于发生了什么的任何想法?

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

更新:生成的wsdl是:

<?xml 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>

错误代码为:

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)

推荐答案

我在很多其他论坛上看到过这个问题,但根本没有任何回应.这似乎是 Axis 1.x 中的一个问题,所以最后我要更改为另一个 SOAP 堆栈(在我的情况下为 Axis2).一切正常.

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.

这篇关于“没有这样的操作"轴网络服务中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆