2016-11-19 61 views
0

我试图使用wso2 ESB作为REST API公开SOAP后端。我使用有效载荷工厂来发送肥皂主体消息,但它不起作用。SOAP消息不是使用wso2 ESB REST API发送的

这在WSO2 ESB代码我的API资源:

<?xml version="1.0" encoding="UTF-8"?> 
<api context="/akademik" name="SampleAPI" xmlns="http://ws.apache.org/ns/synapse"> 
<resource methods="GET" uri-template="/students?symbol={symbol}"> 
    <inSequence> 
     <log level="custom"> 
      <property expression="$url:symbol" name="symbol"/> 
     </log> 
     <payloadFactory media-type="xml"> 
      <format> 
       <soapenv:Envelope xmlns:sem="http://semogabisa.te.net/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 
        <soapenv:Header/> 
        <soapenv:Body> 
         <sem:sayHi> 
          <arg0>$1</arg0> 
         </sem:sayHi> 
        </soapenv:Body> 
       </soapenv:Envelope> 
      </format> 
      <args> 
       <arg evaluator="xml" expression="$url:symbol"/> 
      </args> 
     </payloadFactory> 
     <header scope="default"> 
      <m:complexHeader xmlns:m="http://org.synapse.example"> 
       <m:property key="Content-Type" value="application/xml"/> 
      </m:complexHeader> 
     </header> 
     <send> 
      <endpoint> 
       <address format="soap11" uri="http://localhost:8084/HelloWorld"/> 
      </endpoint> 
     </send> 
    </inSequence> 
    <outSequence> 
     <send/> 
    </outSequence> 
    <faultSequence/> 
</resource> 

SOAP消息不发送到后端的Web服务,它说空。

我已经测试的后端服务与SOAPUI具有相同的SOAP信封格式,它的工作

enter image description here

回答

0

我认为你做的头调解员的一些错误。 “HelloWorld”后端服务不需要基于SOAP UI请求的SOAP头。所以删除头中介。

如果您想操纵SOAP标头,请选择Synapse。如果您想操纵HTTP标头,请选择传输。

而且它似乎是后端是SOAP11,SOAP11类型是“text/xml”。您可能需要设置此属性。

<property name="messageType" value="text/xml" scope="axis2"/> 

当您从ESB发送消息时,需要设置属性“messageType”,然后ESB会格式化匹配后端所需的消息。

如果您发现ESB在将消息发送到后端时将某些上下文附加到后端URI,您可能可能需要此属性。

<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/> 

很好的提示:
请进出ESB打开“synapse.transport.http.wire”为DEBUG,这将输出的每封邮件。该日志将包括HTTP标头和正文。在获得连线日志后,您可以将连线日志与您的SOAPUI请求进行比较,然后找出哪个部分是错误的。
https://docs.wso2.com/display/ESB481/Setting+Up+Logging

+0

这里正好放置了这两个属性? –

+0

@LyanDwiPangestu发送之前“inSequence” – James

+0

我已经像你说的那样编辑它,并将synapse.transport.http.wire作为DEBUG并发现wso2向参数'arg0'添加了一些xml命名空间。它变得像这样 ' Foobar的 ' –