[jboss-user] [JBossWS] - Problem with SOAP Attachments using EJB 2.1 Web Service Endp

mnorthu do-not-reply at jboss.com
Tue Jul 18 19:16:43 EDT 2006


We are trying to build an interoperable web service implemented using an EJB 2.1 service endpoint.  We are starting from WSDL using Sun's tools (wscompile) to generate ties, etc.  The deployment consists only of an ejb-jar file with the appropriate deployment descriptors.  The web service should run on any J2EE 1.4 appserver but I'm having trouble with JBOSS.

The web service allows for download of arbitrary files; therefore the mime-type of the response is not known ahead of time.  

For maximum interoperability the attachments are sent via document/literal WSDL using SwaRef/xsd:anyURI according to Sun's example:

https://jax-rpc.dev.java.net/whitepaper/1.1.2/attachments-howto.html

As such, my business method generates and returns a java.net.URI (the Content-ID of the attachment).  Using properties on the EJB MessageContext and SAAJ I am attempting to create/add the attachment to the SOAP response using a custom handler declared in webservices.xml  

By using SOAPMessage.writeTo( System.out ) the logs appear to show the correct SOAP message:

11:33:23,890 ERROR [STDERR] Jul 18, 2006 11:33:23 AM com.rtn.ejb.AttachmentHandler handleResponse
INFO: Message content:
------=_Part_2_150842.1153240403820
Content-Type: text/xml; charset=UTF-8
Content-Transfer-Encoding: 8bit
Content-ID: <rootpart at ws.jboss.org>

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
 <env:Header/>
 <env:Body>
  <ns1:retrieveProductResponse xmlns:ns1='java:com.rtn.ejb' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
   cid:result=realData.xml at rtn.com
  </ns1:retrieveProductResponse>
 </env:Body>
</env:Envelope>
------=_Part_2_150842.1153240403820
Content-Type: text/xml
Content-Transfer-Encoding: binary
Content-Id: <result=realData.xml at rtn.com>

<?xml version="1.0" encoding="UTF-8"?>
<!-- test example of an XML attachment -->
hello, world!

------=_Part_2_150842.1153240403820--

However, using a TCP Monitor program it appears that the SOAPMessage isn't getting onto the wire properly.  

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)/Tomcat-5.5
Set-Cookie: JSESSIONID=0764D1BC6FB60F654B3E38ECAEF7F36F; Path=/
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 18 Jul 2006 23:05:05 GMT

<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header/>
<env:Body><ns1:retrieveProductResponse xmlns:ns1='java:com.rtn.ejb' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>cid:result=realData.xml at rtn.com

</ns1:retrieveProductResponse>
</env:Body>
</env:Envelope>

Somehow JBOSS is not saving my attachment or it is reverting to the SOAP message as it existed before the handler got invoked...?

I am disappointed to find very little information regarding this and EJB endpoints on the Web.  I have created a sample ANT script and test case and can provide it for evaluation.  If anyone has implemented something like this please let me know what I'm doing wrong.

Thanks,
~Max

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958979#3958979

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958979



More information about the jboss-user mailing list