[jboss-user] [JBossWS] - My WS doesn't send any attachment... why?
cdc08x
do-not-reply at jboss.com
Thu Dec 6 05:08:12 EST 2007
Hi all!
I'm using the EJB3.0 spec. with JBoss AS 4.2.2 (and the related JBossWS version inside, of course), in order to create a Web Service using a Stateless Session Bean instead of a Servlet.
I'd like to send an attachment from within a Web Service method.
Here I explain my problem.
I programmed as follows my Stateless Session Bean:
| ...
| @Stateless(name="PortalInfoExchangeServiceEJB")
| @WebService(
| name="PortalInfoExchange",
| serviceName="PortalInfoExchange",
| targetNamespace="http://www.provincia.latina.it/servizi/ws/portal/PortalInfoExchange",
| endpointInterface = "servizi.it.latina.provincia.portal.ws.PortalInfoExchangeWS")
| @Remote(PortalInfoExchangeWS.class)
| public class PortalInfoExchangeBean implements PortalInfoExchangeWS {
| @Resource WebServiceContext context;
| ...
| public String interact(
| String xmlData
| ) throws IllegalArgumentException {
|
| // Start-up
| String pdfFilePath = "/var/www/SOAPprova/prova.pdf";
| ...
| // Attachment
| SOAPMessageContext msgContext = (SOAPMessageContext)context.getMessageContext();
| SOAPMessage soapMessage = msgContext.getMessage();
| DataHandler dh = new DataHandler(new FileDataSource(pdfFilePath));
| AttachmentPart attachment = soapMessage.createAttachmentPart(dh);
|
| soapMessage.addAttachmentPart(attachment);
| ...
| // Return
| return "Ciao " + xQueryResult + "! [ xQuery: \"for $nome in doc('/home/cdc/workspace/LTPortalWS/build/classes/servizi/it/latina/provincia/portal/ws/tmp.xml')/dataWrapper/dati/nome return data($nome)\" ]";
| }
|
But when I call this service from a PHP Client, sniffing the SOAP response packet I see this:
| HTTP/1.1 200 OK
| Server: Apache-Coyote/1.1
| X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5
| Content-Type: text/xml;charset=UTF-8
| Date: Thu, 06 Dec 2007 09:56:13 GMT
| Connection: close
|
| <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
| <env:Header>
| </env:Header>
| <env:Body>
| <ns2:interactResponse xmlns:ns2="http://www.provincia.latina.it/servizi/ws/portal/PortalInfoExchange">
| <xmlData>Ciao Claudio! [ xQuery: "for $nome in doc('/home/cdc/workspace/LTPortalWS/build/classes/servizi/it/latina/provincia/portal/ws/tmp.xml')/dataWrapper/dati/nome return data($nome)" ]</xmlData>
|
| </ns2:interactResponse>
| </env:Body>
| </env:Envelope>
|
Please, could anyone suggest me why there's no attachment?
Have I got to change somehow manually the WSDL to specify that there will be an attachment?
Did I make something wrong into the code?
I searched a lot around the web, but found nothing...
Any help will be very appreciated!
Claudio Di Ciccio
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4110782#4110782
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4110782
More information about the jboss-user
mailing list