Lyan Dwi Pangestu Lyan Dwi Pangestu - 1 year ago 251
reST (reStructuredText) Question

SOAP messages are not sent using wso2 ESB REST API

I'm trying to expose SOAP backend as REST API using wso2 ESB. I'm using payload factory to send the soap body message, but it doesn't work.

This is my API resource in wso2 esb code :

<?xml version="1.0" encoding="UTF-8"?>
<api context="/akademik" name="SampleAPI" xmlns="">
<resource methods="GET" uri-template="/students?symbol={symbol}">
<log level="custom">
<property expression="$url:symbol" name="symbol"/>
<payloadFactory media-type="xml">
<soapenv:Envelope xmlns:sem="" xmlns:soapenv="">
<arg evaluator="xml" expression="$url:symbol"/>
<header scope="default">
<m:complexHeader xmlns:m="http://org.synapse.example">
<m:property key="Content-Type" value="application/xml"/>
<address format="soap11" uri="http://localhost:8084/HelloWorld"/>

Soap messages are not sent to the backend web service, it says null.

I've test the backend service with SOAPUI with same soap envelope format and it's working

enter image description here

Answer Source

I think you make some mistake on the header mediator. "HelloWorld" back end service didn't need the SOAP header based on your SOAP UI request. so remove the header mediator.

Select Synapse if you want to manipulate SOAP headers. Select Transport if you want to manipulate HTTP headers.

And it's seems back end is SOAP11, SOAP11 type is "text/xml". Your may need set this property.

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

When you send message out from ESB, you need set property "messageType", then ESB will formatter the message that match back end required.

You may probably need this property, if you found ESB append some context to your back end URI when send message to back end.

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

Good Tips:
Please open your "synapse.transport.http.wire" as DEBUG, this will output every message in and out from ESB. This log will including HTTP header and body. After you got the wire log, you can compare wire log with your SOAPUI request, then find out which part is wrong.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download