WS consuption

时间:2015-05-12 17:24:06

标签: web-services soap wsdl soapui

我正在尝试使用SOAPRequest节点从IBMIntegrationBus v10查询WS。

使用以下有效负载消耗此WS时,SoapUI没有问题:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsg="http://wsgetrama.wsbeans.iseries/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soapenv:Header/>
   <soapenv:Body>
      <out:wsgetrama xmlns:out="http://wsgetrama.wsbeans.iseries/">
         <arg0>
            <PERAMA>1</PERAMA>
            <PERAMD>Test</PERAMD>
         </arg0>
      </out:wsgetrama>
   </soapenv:Body>
</soapenv:Envelope>

原始数据如下:

POST http://192.168.1.116:10028/web/services/WSGETRAMAService/WSGETRAMA HTTP/1.1
Accept-Encoding: gzip,deflate   
Content-Type: text/xml;charset=UTF-8   
SOAPAction: ""   
Content-Length: 643   
Host: 192.168.1.116:10028   
Connection: Keep-Alive   
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

我正在尝试使用以下WSDL来使用WS:

<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://wsgetrama.wsbeans.iseries/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" name="WSGETRAMA" targetNamespace="http://wsgetrama.wsbeans.iseries/">
<types>
<xs:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:tns="http://wsgetrama.wsbeans.iseries/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://wsgetrama.wsbeans.iseries/" version="1.0">
<xs:element name="wsgetrama" type="tns:wsgetrama"/>
<xs:element name="wsgetramaResponse" type="tns:wsgetramaResponse"/>
<xs:complexType name="wsgetrama">
<xs:sequence>
<xs:element name="arg0" type="tns:wsgetramaInput"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="wsgetramaInput">
<xs:sequence>
<xs:element name="PERAMA" type="xs:decimal"/>
<xs:element name="PERAMD" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="wsgetramaResponse">
<xs:sequence>
<xs:element name="return" type="tns:wsgetramaResult"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="wsgetramaResult">
<xs:sequence>
<xs:element name="PERAMD" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
<message name="wsgetrama">
<part element="tns:wsgetrama" name="parameters"></part>
</message>
<message name="wsgetramaResponse">
<part element="tns:wsgetramaResponse" name="parameters"></part>
</message>
<portType name="WSGETRAMAServices">
<operation name="wsgetrama">
<input message="tns:wsgetrama" wsam:Action="http://wsgetrama.wsbeans.iseries/WSGETRAMAServices/wsgetramaRequest"></input>
<output message="tns:wsgetramaResponse" wsam:Action="http://wsgetrama.wsbeans.iseries/WSGETRAMAServices/wsgetramaResponse"></output>
</operation>
</portType>
<binding name="WSGETRAMAServicesPortBinding" type="tns:WSGETRAMAServices">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="wsgetrama">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="WSGETRAMA">
<port binding="tns:WSGETRAMAServicesPortBinding" name="WSGETRAMAServicesPort">
<soap:address location="http://192.168.1.116:10028/web/services/WSGETRAMAService/WSGETRAMA"/>
</port>
</service>
</definitions>

虽然SoapUI没有使用它的问题,但当我在集成总线上尝试相同时,我收到以下错误:

  

给定的SOAPAction wsgetrama与操作

不匹配

为了使用这个WS,我已经导入了上面提到的WSDL并且基于它的SOAPRequest节点。

任何想法都将不胜感激!

谢谢! 肖恩

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。我正在尝试从IBM Integration Bus消息流中使用jboss EAP 6.2中公开的Web服务,并且我得到了相同的消息(服务没有响应,看着server.log我注意到了同样的错误“给定的SOAPAction generarDocumento没有匹配一个操作“)。

wsdl确实包含一个空白的soapaction:

<wsdl:operation name="generarDocumento">
    <soap:operation soapAction="" style="document"/>
    <wsdl:input name="generarDocumento">
        <soap:body use="literal"/>
    </wsdl:input>
    <wsdl:output name="generarDocumentoResponse">
        <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="ControladaException">
        <soap:fault name="ControladaException" use="literal"/>
    </wsdl:fault>
</wsdl:operation>

我在IBM知识库中发现了这个问题:

“如果在HTTPInput标头中将SOAPAction设置为空字符串,则会覆盖它,除非在HTTPRequest标头中显式设置该操作,例如:

SET OutputRoot.HTTPRequestHeader.SOAPAction =   InputRoot.HTTPInputHeader.SOAPAction

我正在使用JavaCompute节点,因此我仍在研究如何将上述ESQL代码转换为Java,以替换HTTP请求并将soapaction设置为空白。

如果我成功的话,我会告诉大家的。