Quantcast
Channel: SCN : Discussion List - SAP Sourcing
Viewing all articles
Browse latest Browse all 1416

Not able to send attachments from Sourcing W9 to PI web service

$
0
0

Hi,

 

We have a requirement to extract some details of Suppliers, including an extension Attachment field and pass these values to PI/PO. There is a SOAP web service at PI/PO side. I am able to send test data to this web service from an independent java program. The same logic is deployed in Sourcing as custom JAR. I have written a prepublish script in Sourcing. If the attachment is not passed, I am able to get a successful response from the web service. But when I try to pass the attachment, the message send itself fails.

 

I am using javax,xml.soap.SOAPMessage class to create the request. The web service is in SOAP 1.1

This is the code in my custom jar for processing attachment:

               File attch = vendorData.getW9Attach(); 

                FileDataSource fds = new FileDataSource(attch.getName());

                DataHandler dh = new DataHandler(fds);

                AttachmentPart attachment = message.createAttachmentPart();

                attachment.setDataHandler(dh);

               attachment.setContentId(attachFileName);

               message.addAttachmentPart(attachment);

 

Without this code to add attachment, I get a successful response. When I add the above code, I get the error message:

com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Unable to internalize message

 

The stackTrace is:

com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:148), com.*****.custom.WebClientForVendorPublish.getResponseForVendorData(WebClientForVendorPublish.java:375), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25), java.lang.reflect.Method.invoke(Method.java:597), bsh.Reflect.invokeOnMethod(Unknown Source), bsh.Reflect.invokeObjectMethod(Unknown Source), bsh.Name.invokeMethod(Unknown Source), bsh.BSHMethodInvocation.eval(Unknown Source), bsh.BSHPrimaryExpression.eval(Unknown Source), bsh.BSHPrimaryExpression.eval(Unknown Source), bsh.BSHBlock.evalBlock(Unknown Source), bsh.BSHBlock.eval(Unknown Source), bsh.BSHBlock.eval(Unknown Source), bsh.BSHTryStatement.eval(Unknown Source), bsh.Interpreter.eval(Unknown Source), bsh.Interpreter.eval(Unknown Source), bsh.Interpreter.eval(Unknown Source), com.sap.odp.comp.scripting.ScriptEnvironment.execute(ScriptEnvironment.java:144), com.sap.odp.comp.scripting.ScriptManager.executeDocumentEventScript(ScriptManager.java:1009), com.sap.odp.doc.ContainerBo.executeDocumentEventScript(ContainerBo.java:5722), com.sap.odp.doc.ContainerBo.prePublishERP(ContainerBo.java:6018), com.sap.odp.doccommon.masterdata.VendorHome.publishToERP(VendorHome.java:753), com.sap.eso.doccommon.doc.rq.IntegrationPublishRQ.processRequestHook(IntegrationPublishRQ.java:110), com.sap.odp.doc.display.util.AbsDocRQ.processRequest(AbsDocRQ.java:199), com.sap.odp.doc.display.util.AbsRQ.run(AbsRQ.java:110), java.lang.Thread.run(Thread.java)


If anyone has successfully used SOAP 1.1 with attachment from Sourcing, please help


Viewing all articles
Browse latest Browse all 1416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>