title: Spring integration ws:outbound-gateway jaxb internal server error[500]
body: <p>I am trying to invoke, a webservice(spring-ws) from spring integration using ws:outbound-gateway. I have used jaxb2marshaller for oxm mapping. Initially I have used a jms:inbound-channel-adapter, to recieve input object, convert it to JAXBElement(Sample), where in Sample is generated by JAXB from WS-XSD schema. The object factory is used to get JAXBElement. </p>
  
  <p>I am receiving error Internal Server error[500] at client(Spring-Integration) when executed. And on service end(Spring-WS) is throws, Found invalid char '-', expecting '>'. The same service(Spring-ws) works fine and replies well with an Axis-2 client. So I assume there is no issue on service end and the message sent from client(spring-integration) is improper.</p>
  
  <p>Please suggest me if there is a proper way of doing this, or am I missing something</p>
  
  <p>Spring_integration client</p>
  
  <pre><code>&lt;int:channel id="wsChainInboundChannel"/&gt;
  &lt;int:chain input-channel="wsChainInboundChannel" output-channel="wsInboundChannel"&gt;
      &lt;int:transformer ref="jms2wsTransform" method="jmsOrderToWSEmployee"/&gt;
  &lt;/int:chain&gt;
  &lt;int:channel id="wsInboundChannel"/&gt;
  &lt;int-ws:outbound-gateway id="wsOutboundGateway" request-channel="wsInboundChannel" uri="http://localhost:8081/mywebservice/servicelayer"
    marshaller="masterdatajaxb2Marshaller" unmarshaller="masterdatajaxb2Marshaller"
    reply-channel="wsOutboundChannel" message-factory="messageFactory"/&gt;
  
   &lt;bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory"&gt;
      &lt;property name="messageFactory"&gt;
          &lt;bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/&gt;
      &lt;/property&gt;
  &lt;/bean&gt;
  
  &lt;int:channel id="wsOutboundChannel"/&gt;
  </code></pre>
  
  <p>jmsOrderToWSEmployee method in jms2wsTransform is</p>
  
  <pre><code>public class WS2JMSTransformer {
  private final ObjectFactory jaxbFactory = new ObjectFactory();
  
  public JAXBElement&lt;TEmployeeBySecurityRequest&gt; jmsOrderToWSEmployee(Message&lt;Order&gt; message){
      Order order = message.getPayload();
      TEmployeeBySecurityRequest request = new TEmployeeBySecurityRequest();
      request.setEmployeeId(order.getOrderQuantity().longValue());
      return jaxbFactory.createEmployeeBySecurityRequest(request);
  }
  }
  </code></pre>
  
  <p>With TCP Monitor normal well executed request SOAP is</p>
  
  <pre><code>--MIMEBoundary_57eb271a7b65c0bacefa0a80da1b203d0661422ab29d24a3
  Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
  Content-Transfer-Encoding: binary
  Content-ID: &lt;0.47eb271a7b65c0bacefa0a80da1b203d0661422ab29d24a3@apache.org&gt;
  
  &lt;?xml version='1.0' encoding='UTF-8'?&gt;&lt;soapenv:Envelope
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soapenv:Body&gt;  
  &lt;ns1:employeeBySecurity_Request xmlns:ns1="http://com/clickandbuy/mywebservice/"&gt;   
  &lt;ns1:employeeId&gt;12312&lt;/ns1:employeeId&gt;&lt;/ns1:employeeBySecurity_Request&gt;&lt;/soapenv:Body&gt; 
  &lt;/soapenv:Envelope&gt;
  --MIMEBoundary_57eb271a7b65c0bacefa0a80da1b203d0661422ab29d24a3--
  </code></pre>
  
  <p>And with Spring_integartion client SOAP(error one) is,</p>
  
  <pre><code>------=_Part_0_157378300.1372091736608
  Content-Type: application/xop+xml; charset=utf-8; type="text/xml"
  
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;SOAP-  
  ENV:Header/&gt;&lt;SOAP-ENV:Body&gt;&lt;ns2:employeeBySecurity_Request   
  xmlns:ns2="http://com/clickandbuy/mywebservice/"&gt;&lt;ns2:employeeId&gt;6&lt;/ns2:employeeId&gt;
  &lt;/ns2:employeeBySecurity_Request&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;
  ------=_Part_0_157378300.1372091736608--
  </code></pre>
  
  <p>I observe that 
      ?xml version='1.0' encoding='UTF-8'?>
  and few other things missing. Is there some way to resolve this</p>
  
  <p>Thanks</p>