我有一个JBoss 5.1 Web服务,有两个操作
两个操作采用相同的请求类型
每个人都有自己的行动
Web服务编译和部署很好,但是当我尝试使用soapUI提交请求时,我收到以下错误:
无法唯一地识别操作:{https://garygateway.quinn.co.za/services/garygateway} GaryRequest
这是我的WSDL
<definitions name='GaryGatewayService' targetNamespace='https://garygateway.mediswitch.co.za/services/garygateway' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='https://garygateway.quinn.co.za/services/garygateway' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='https://garygateway.mediswitch.co.za/services/garygateway' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<types>
<xs:schema targetNamespace='https://garygateway.quinn.co.za/services/garygateway' version='1.0' xmlns:ns1='https://garygateway.mediswitch.co.za/services/garygateway' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:import namespace='https://garygateway.mediswitch.co.za/services/garygateway'/>
<xs:element name='GaryRequest' nillable='true' type='ns1:garyRequest'/>
<xs:element name='GaryResponse' nillable='true' type='ns1:garyResponse'/>
</xs:schema>
<xs:schema targetNamespace='https://garygateway.mediswitch.co.za/services/garygateway' version='1.0' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
<xs:complexType name='garyRequest'>
<xs:sequence>
<xs:element minOccurs='0' name='id' type='xs:string'/>
<xs:element minOccurs='0' name='name' type='xs:string'/>
<xs:element minOccurs='0' name='surname' type='xs:string'/>
</xs:sequence>
</xs:complexType>
<xs:complexType name='garyResponse'>
<xs:sequence>
<xs:element minOccurs='0' name='message' type='xs:string'/>
<xs:element minOccurs='0' name='status' type='xs:string'/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name='GaryGatewayEndpoint_requestOneResponse'>
<part element='ns1:GaryResponse' name='GaryResponse'></part>
</message>
<message name='GaryGatewayEndpoint_requestTwoResponse'>
<part element='ns1:GaryResponse' name='GaryResponse'></part>
</message>
<message name='GaryGatewayEndpoint_requestTwo'>
<part element='ns1:GaryRequest' name='requestTwo'></part>
</message>
<message name='GaryGatewayEndpoint_requestOne'>
<part element='ns1:GaryRequest' name='requestOne'></part>
</message>
<portType name='GaryGatewayEndpoint'>
<operation name='requestOne' parameterOrder='requestOne'>
<input message='tns:GaryGatewayEndpoint_requestOne'></input>
<output message='tns:GaryGatewayEndpoint_requestOneResponse'></output>
</operation>
<operation name='requestTwo' parameterOrder='requestTwo'>
<input message='tns:GaryGatewayEndpoint_requestTwo'></input>
<output message='tns:GaryGatewayEndpoint_requestTwoResponse'></output>
</operation>
</portType>
<binding name='GaryGatewayEndpointBinding' type='tns:GaryGatewayEndpoint'>
<soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='requestOne'>
<soap:operation soapAction='https://garygateway.quinn.co.za/services/garygateway/requestOne'/>
<input>
<soap:body use='literal'/>
</input>
<output>
<soap:body use='literal'/>
</output>
</operation>
<operation name='requestTwo'>
<soap:operation soapAction='https://garygateway.quinn.co.za/services/garygateway/requestTwo'/>
<input>
<soap:body use='literal'/>
</input>
<output>
<soap:body use='literal'/>
</output>
</operation>
</binding>
<service name='GaryGatewayService'>
<port binding='tns:GaryGatewayEndpointBinding' name='GaryGatewayEndpointPort'>
<soap:address location='http://gary-desktop:8480/wsgateway/GaryGateway'/>
</port>
</service>
</definitions>
我启用了WS-A寻址,使得Soap消息头看起来像这样:
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing"><wsa:Action>https://garygateway.mediswitch.co.za/services/garygateway/GaryGatewayEndpoint/requestOneRequest</wsa:Action></soapenv:Header>
以下是SoapU也生成的标题:
POST /wsgateway/GaryGateway HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "https://garygateway.quinn.co.za/services/garygateway/GaryGatewayEndpoint/requestOneRequest"
Content-Length: 544
Host: gary-desktop:8480
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
但我仍然得到无法唯一识别操作错误
以下是完整回复:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>Cannot uniquely indentify operation: {https://garygateway.quinn.co.za/services/garygateway}GaryRequest</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
答案 0 :(得分:0)
我必须在网络服务上启用寻址
@WebService(name = "", targetNamespace = "")
@Addressing(enabled = true, required = true)