Hi All,

I made some modification to the Helloworld SE to accept/respond SOAP messages 
over HTTP. I was able to send request to the service and receive response. But 
when i added some text to the out.addAttachement, I dont find the content in 
the attachement..
 
 
### Request ###
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
 <SOAP-ENV:Header/>
 <SOAP-ENV:Body> 
  <request>Hello</request>  
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

### Response ###
------=_Part_1_14680585.1218588519740
Content-Type: text/xml; charset=Cp1252
Content-Transfer-Encoding: 8bit
Content-ID: <soap-request>
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";>
 <SOAP-ENV:Body>
  <response>Hello OK</response>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
------=_Part_1_14680585.1218588519740
Content-Type: text/plain; charset=Cp1252
Content-Transfer-Encoding: 8bit
Content-ID: <AttData>

------=_Part_1_14680585.1218588519740--
 
 
 
These are the changes i did.
 
HTTP-SU (making it to accept SOAP request)
 
<http:endpoint service="xyz:helloWorld" 
endpoint="helloWorld" 
role="consumer" 
locationURI="http://0.0.0.0:8192/WSService/"; 
defaultMep="http://www.w3.org/2004/08/wsdl/in-out"; 
soap="true"/>
 
HelloWorld SE
 
/**
* @org.apache.xbean.XBean element="endpoint"
*/
public class MyEndpoint extends ProviderEndpoint {
  protected void processInOut(MessageExchange exchange, NormalizedMessage in,
  NormalizedMessage out) throws Exception {
    .
    .
    .
    .
    
    StreamDataSource sds = new StreamDataSource(new 
ByteArrayInputStream("HelloWorld".getBytes()), "text/plain");
    sds.setName("Test");
    DataHandler dh = new DataHandler(sds);

    out.addAttachment("AttData", dh);
 
    out.setContent(new StringSource("<response>Hello OK</response>"));
  }
}
 
 
thanks,
Johnson George


      

Reply via email to