|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
SOAP with attachment over mule using CXFI am trying to develop a inbound SOAP service on Mule that can accept attachments as well in SOAP.
My configuration: In mule coniguration file I have : <service name="serviceone"> <inbound> <cxf:inbound-endpoint address="http://localhost:63081/hello"> <cxf:inInterceptors> <spring:bean class="net.syscon.mule.test.MySoapInterceptor" /> </cxf:inInterceptors> </cxf:inbound-endpoint> </inbound> <component class="net.syscon.mule.test.TestHelloWorldImpl" /> </service> I have the jar file with proper classes in the $MULE_HOME/user/lib directory. The code for net.syscon.mule.test.MySoapInterceptor is : package mule.test; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.Collection; import java.util.Iterator; import javax.activation.DataHandler; import org.apache.cxf.binding.soap.SoapMessage; import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; import org.apache.cxf.message.Attachment; import org.apache.cxf.phase.Phase; public class MySoapInterceptor extends AbstractSoapInterceptor { public MySoapInterceptor() { super(Phase.RECEIVE); } public void handleMessage(SoapMessage soapMessage) { System.out.println("I am innnnnnn SOAPmesg interceptor. "); try { System.out.println("DEBUG 1 In SOAP attachment thing."); Collection<Attachment> col = soapMessage.getAttachments(); Iterator<Attachment> it = col.iterator(); while (it.hasNext()) { Attachment at = it.next(); DataHandler dh = at.getDataHandler(); InputStream is = dh.getInputStream(); File f = new File("ddd.jpeg"); OutputStream os = new FileOutputStream(f); byte[] b = new byte[1024]; while(is.available() > 0){ is.read(b); os.write(b); } System.out.println("DEBUG 2 Finished SOAP attachment thing.."); is.close(); os.close(); } } catch (Exception e) { e.printStackTrace(); } } } When I execute the this with a SOAP with attachment I get a NullPointerException in the net.syscon.mule.test.MySoapInterceptor. The object returned by soapmessage.getAttachments(); is NULL. I have check the SOAP message sent by the client and it confirms to the SOAP standards. Can anyone help in figuring out why I am mule is returning on the call soapmessage.getAttachments() please? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: SOAP with attachment over mule using CXFFurther debugging revealed that the error occurs when I try to get the attachment in the Interceptor.
It throws org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: ------=_Part_0_2025190714.1256166722535 SOAP Message is : ------=_Part_1_2114727925.1256166722701 Content-Type: text/xml; charset=utf-8 <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <m:sayHi xmlns:m="http://test.mule.syscon.net/"> <arg0>asdffffffffffffff</arg0> </m:sayHi> </SOAP-ENV:Body> </SOAP-ENV:Envelope> ------=_Part_1_2114727925.1256166722701 Content-Type: x-application/octet-stream BINARY DATA HERE.. ------=_Part_1_2114727925.1256166722701 --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |