2014-01-28 197 views
0

我有一个wsdl(RPC编码),它包含2对具有相同操作名称但具有不同参数和不同输入/输出消息的操作。WSDL中具有相同名称但具有不同参数的两个操作

这里是wsdl的重要部分(我可以生成java代码,而wsdl是有效的)。

<!-- message for the first operation --> 
<wsdl:message name="SomethingGoodRequest"> 
    <wsdl:part name="paramOne" type="xsd:int"> 
    </wsdl:part> 
    <wsdl:part name="paramTwo" type="soapenc:string"> 
    </wsdl:part> 
    <wsdl:part name="paramThree" type="soapenc:string"> 
    </wsdl:part> 
    <wsdl:part name="paramFour" type="soapenc:string"> 
    </wsdl:part> 
    <wsdl:part name="paramFive" type="soapenc:string"> 
    </wsdl:part> 
</wsdl:message> 

<!-- message for the second operation --> 
<wsdl:message name="SomethingGoodRequest1"> 
    <wsdl:part name="paramOne" type="xsd:int"> 
    </wsdl:part> 
    <wsdl:part name="paramTwo" type="soapenc:string"> 
    </wsdl:part> 
    <wsdl:part name="paramThree" type="tns1:VerySpecialTypeForGoodThings"> 
    </wsdl:part> 
    <wsdl:part name="paramFour" type="soapenc:string"> 
    </wsdl:part> 
    <wsdl:part name="paramFive" type="soapenc:string"> 
    </wsdl:part> 
</wsdl:message> 

<!-- the operations --> 
<wsdl:operation name="SomethingGood" parameterOrder="paramOne paramTwo paramThree paramFour paramFive"> 
    <wsdl:input message="impl:SomethingGoodRequest" name="SomethingGoodRequest" /> 
    <wsdl:output message="impl:SomethingGoodResponse" name="SomethingGoodResponse" /> 
</wsdl:operation> 
<wsdl:operation name="SomethingGood" parameterOrder="paramOne paramTwo paramThree"> 
    <wsdl:input message="impl:SomethingGoodRequest1" name="SomethingGoodRequest1" /> 
    <wsdl:output message="impl:SomethingGoodResponse1" name="SomethingGoodResponse1" /> 
</wsdl:operation> 

<wsdl:operation name="SomethingGood"> 
    <wsdlsoap:operation soapAction=""/> 
    <wsdl:input name="SomethingGoodRequest"> 
     <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://nevermind" use="encoded"/> 
    </wsdl:input> 
    <wsdl:output name="SomethingGoodResponse"> 
     <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://nevermind" use="encoded"/> 
    </wsdl:output> 
</wsdl:operation> 

<wsdl:operation name="SomethingGood"> 
    <wsdlsoap:operation soapAction=""/> 
    <wsdl:input name="SomethingGoodRequest1"> 
     <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://nevermind" use="encoded"/> 
    </wsdl:input> 
    <wsdl:output name="SomethingGoodResponse1"> 
     <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://nevermind" use="encoded"/> 
    </wsdl:output> 
</wsdl:operation> 

的问题是,每当我试图调用第二个方法(从谁共享两个相同名字的)我得到这个异常(500内部服务器错误):

faultDetail: 
     {}:return code: 500 
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
    <soapenv:Body> 
    <soapenv:Fault> 
     <faultcode>Server</faultcode> 
     <faultstring>Missing operation for soapAction [] and body element [{http://nevermind/}SomethingGood] with SOAP Version [SOAP 1.1]</faultstring> 
    </soapenv:Fault> 
    </soapenv:Body> 
</soapenv:Envelope> 

有趣的事是,我可以毫无问题地调用其他所有操作(从java客户端和SoapUI中),并且我可以从共享相同名称的用户中调用第一个操作。

因此,我可以用5个参数成功SomethingGood,但是当我尝试使用3个参数调用这个参数时,我得到上面描述的异常。

是否有任何解决方法,或仅通过修复wsdl? (我得到了wsdl,所以我不能自己编辑它)

在此先感谢!

+1

无论谁给你这个wsdl,他在产生这种wsdl时都必须警告。他根本无视它。在这种情况下,您可以提供不同的SOAP Action,但是您必须再次编辑您的wsdl。 – kingAm

回答

2

尽管在WSLD中超载方法是合法的,但WS-I basic profile不允许使用此功能。 AXIS,JAX-WS,CXF,Spring和其他一些框架声称符合基本配置文件。无论是谁创建这个WSDL可能都不符合java/BP兼容的Web服务,如果你坚持使用这些框架,你必须修改WSDL。

相关问题