title: WSO2 ESB - How to build soapenv:Body for remote service call
body: <p>I have the WSDL file of the remote web service I need to call from a proxy service in the WSO2 ESB and would like to know if I need to construct the soap:Body's elements manually through XSLT/Enrich or there is a way to generate the soapenv:Body's contains from the WSDL and maybe replace '?' for the values. </p>
  
  <p>For example, if you've used soapUI before you'll know that when you import a WSDL file in a project a soapenv:Envelope gets generated automatically with all the XML elements and question marks for their values. Same goes for the TryIt tool in the WSO2 ESB.</p>
  
  <p>Here is an example of an auto-generated soapenv:Envelope in soapUI after importing WSDL:</p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:abc="http://abc.com/"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;abc:RegisterCandidate&gt;
           &lt;abc:NameFirst&gt;?&lt;/abc:NameFirst&gt;
           &lt;abc:NameMiddle&gt;?&lt;/abc:NameMiddle&gt;
           &lt;abc:NameLast&gt;?&lt;/abc:NameLast&gt;
           &lt;abc:PhoneHome&gt;?&lt;/abc:PhoneHome&gt;
           &lt;abc:EmailAddress&gt;?&lt;/abc:EmailAddress&gt;
           &lt;abc:Address1&gt;?&lt;/abc:Address1&gt;
           &lt;abc:Address2&gt;?&lt;/abc:Address2&gt;
           &lt;abc:City&gt;?&lt;/abc:City&gt;
           &lt;abc:State&gt;?&lt;/abc:State&gt;
           &lt;abc:ZipCode&gt;?&lt;/abc:ZipCode&gt;
           &lt;abc:Country&gt;?&lt;/abc:Country&gt;
        &lt;/abc:RegisterCandidate&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>Is this possible in the Proxy Service through any of the mediators available to read a WSDL and generate soapenv:Body with its XML tags (in the code above it would be abc:RegisterCandidate with its children)? I've done it with the use of the XSL templates, but it's manual and not very elegant.</p>
  
  <p>I've found a few articles/blogs online about writing proxy services in the WSO2 ESB that call remote web services and what the developers were doing in there was to insert the XML elements needed in the soapenv:Body with the use of XSL templates to have the correct/full SOAP message that is then sent (send mediator) to the remote web service server.</p>
  
  <p>Thank you.</p>