0
votes

I have a SOAP proxy service with a Data Mapper to create the output. The created response does not have the soap envelope tag. If I try to add the envelope with the payload factory, it strips out the envelope (but it keeps the Body element). I'm using the WSO2 EI 6.4.0.

<?xml version="1.0" encoding="UTF-8"?>
<proxy name="EstrattoContoEntiTributi" startOnLoad="true" transports="http https" xmlns="http://ws.apache.org/ns/synapse">
    <target>
        <inSequence>
            ...
            <send>
                <endpoint key="..."/>
            </send>
        </inSequence>
        <outSequence>
            <datamapper .../>
            <send/>
        </outSequence>
        <faultSequence/>
    </target>

</proxy>
1
Please, show the source of your proxy.Maxim Fazyloff
here is the codeuser5919369
can you set the content type as application/soap+xml after data mapper and seeNirothipan
It works, but the content type must be set before data mapperuser5919369
@user5919369, why?Maxim Fazyloff

1 Answers

1
votes

We need to use a property mediator as below.

 <proxy xmlns="http://ws.apache.org/ns/synapse"
           name="PF2"
           startOnLoad="true"
           statistics="disable"
           trace="disable"
           transports="http,https">
       <target>
          <inSequence>
             <payloadFactory media-type="xml">
                <format>
                   <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
                                  xmlns:xsd="http://services.samples/xsd"
                                  xmlns:ser="http://services.samples">
                      <soap:Header/>
                      <soap:Body>
                         <ser:getQuote>
                            <ser:request>
                               <xsd:symbol>IBM</xsd:symbol>
                            </ser:request>
                         </ser:getQuote>
                      </soap:Body>
                   </soap:Envelope>
                </format>
                <args/>
             </payloadFactory>
             <property name="messageType" scope="axis2" type="STRING" value="text/xml"/>
             <log level="full">
                <property name="ChangedEnve" value="----Changed-------"/>
             </log>
             <respond/>
          </inSequence>
       </target>
       <description/>
    </proxy>

Hope this helps, https://medium.com/@isuruuy/how-to-construct-a-payload-with-the-soap-envelope-ce8df5032dda