Attaching xml document to SOAP body
Hi,
i have two question.
Q1: Is it allowed to attach xml document (org.w3c.dom.Document) to SOAP body when sending request to web service.( I have implemented web service to accept attached xml document.)
Q2: If it is allowed, how thoes the WSDL look like.
Thanx,
Alan.
Hi,
I am facing the same issue., I want to transform the xml proxy request to SOAP requesting that the business service expects.
Did you manage to solve the issue, if so, can you please share your solution?
Thanks
Similar Messages
-
How to extract the actual XML document from soap message?
My problem is " how to extract the actual XML document from soap message? "
i just want to extract the attachment i.e. (pure XML document without any soap header or envolope).
i could be ver thank full if u could solve my problem.
[email protected]Hi,
This is some skeleton code for extracting an attachment from a SOAPMessage.
import javax.activation.DataHandler.;
import javax.xml.soap.*;
import javax.xml.message.*;
Iterator allAttachments = message.getAttachments();
AttachmentPart ap1 = null;
while(allAttachments.hasNext()){
ap1 = (AttachmentPart)allAttachments.next();
//Check that the attachment is correct one. By looking at its mime headers
//Convert the attachment part into its DOM representation:
if(ap1.getContentType() == "text/xml"){
//Use the activation dataHandler class to extract the content, then create a StreamSource from
//the content.
DataHandler attachmentContent = ap1.getDataHandler();
StreamSource attachmentStream = new StreamSource(attachmentContent.getInputStream());
DOMResult domAttachment = getDOMResult(attachmentStream);
domAttachment holds an xml representation of the attachment.
Hope this helps. -
Adding xml fragment to SOAP body (SAAJ)
Hi all,
we are using SOAP (or better SAAJ) in a modular design as packaging/enveloping format for arbitrary payloads which are generated by different modules.
How is it possible to add a xml fragment (as InputStream or DOM Node) to a SOAP Body ?
Nick
[email protected]Hi Vicky,
I guess, we have a little misunderstanding here. The core SOAP specification defines the structure of the envelope, the "SOAP with attachments" specification extends that by defining how to add binary attachments. This is accomplished by using MIME. Every attachment is another MIMEPart, but the SOAP Envelope always has to be present as first MIMEPart. Now I don't want to add any attachments, I only want to construct a SOAP Envelope that contains arbitrary xml docs (fragments) in the body.
Look at the example below, the tags with namespace "S" belong to the SOAP specification and are built by our SOAP layer, the tags with namespace "m" belong to some other namespace and are generated by a totally different component.
My question was how I could add (within SAAJ) the xml fragment starting with "m:PurchaseOrder" to the envelope without having to add element by element.
<S:Envelope>
<S:Header>
...optional header tags
</S:Header>
<S:Body>
<!---from here it is a different namespace, SOAP doesn't know about PurchaseOrders>
<m:PurchaseOrder>
<m:position>
<m:article>0815</m:article>
<m:description>mainboard</m:description>
<m:price>50</m:price>
</m:position>
<m:position>
<m:article>0816</m:article>
<m:description>cpu</m:description>
<m:price>100</m:price>
</m:position>
</PurchaseOrder>
<!---from here, it is SOAP again>
</S:Body>
</S:Envelope> -
Hey,
I currently have a psuedo webservice that pulls a string out of an http request and returns a corresponding xml document (based on a schema) to the caller. Pretty basic and it works fine. I use JAXB for the Marshalling of my objects to xml, based on the schema, so I know that my xml document is correct (well-formed and valid).
Now, I would like to do the same thing, except as a SOAP-RPC call. I figure, for the service side, I can just wrap what I already generate in a SOAP Envelope, in response to a SOAP request. Creating the client is easy but I am having trouble with the client side. How can I simply pass an xml document as the SOAP body using Axis/JAX-RPC or whatever, instead of re-mapping to Java object, which might not guarantee the response document conforms to my schema?
I've looked at SAAJ for this a bit, but this seems more about sending a message to a service rather than creating a response from a service....
Any ideas?
MikeYes, it's been ten months, but have you figured out how to integrate SOAP and JAXB? I am attempting to make my SOAP client application code easy for a Java beginner to understand, so JAXB would be ideal.
-
Error using SOAPRunner: XML document must have top level element
Hi all,...................xMII 11.5.3 b66
I am attempting to consume a BLS transaction as a web service from a J2EE app.
When I test it with http://naholldo31020/Lighthammer/SOAPRunner/Amy/GetListOfPlants I am getting an error message from the browser. The BLS transaction works fine when called from a Query template. What am I missing?
The XML page cannot be displayed
Cannot view XML input using style sheet.
Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing
resource 'http://naholldo31020/Lighthammer/SOAPRunner/Amy/GetL...
WSDL from WSDLGen...
<?xml version="1.0" encoding="UTF-8" ?>
- <definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:s0="http://www.sap.com/xMII"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" targetNamespace="http://www.sap.com/xMII">
- <!-- Types
-->
- <types>
- <s:schema elementFormDefault="qualified" targetNamespace="http://www.sap.com/xMII">
- <s:complexType name="InputParams">
- <s:sequence id="InputSequence">
<s:element maxOccurs="1" minOccurs="0" name="RequestXML" type="s:Xml" />
<s:element maxOccurs="1" minOccurs="0" name="RowCount" type="s:long" />
<s:element maxOccurs="1" minOccurs="0" name="RowSkips" type="s:long" />
<s:element maxOccurs="1" minOccurs="0" name="Table" type="s:string" />
</s:sequence>
</s:complexType>
- <s:element name="XacuteRequest">
- <s:complexType>
- <s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="LoginName" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="LoginPassword" type="s:string" />
<s:element maxOccurs="1" minOccurs="0" name="InputParams" type="s0:InputParams" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="Rowset">
- <s:sequence>
<s:element maxOccurs="unbounded" minOccurs="0" name="Row" type="s0:Row" />
</s:sequence>
<s:attribute name="Message" type="s:string" />
</s:complexType>
- <s:complexType name="Row">
- <s:sequence id="RowSequence">
<s:element maxOccurs="1" minOccurs="1" name="ErrorMessage" type="s:string" />
<s:element maxOccurs="1" minOccurs="1" name="OutputXML" type="s:string" />
</s:sequence>
</s:complexType>
- <s:element name="XacuteResponse">
- <s:complexType>
- <s:sequence>
<s:element maxOccurs="1" minOccurs="0" name="Rowset" type="s0:Rowset" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</types>
- <!-- Messages
-->
- <message name="XacuteSoapIn">
<part element="s0:XacuteRequest" name="parameters" />
</message>
- <message name="XacuteSoapOut">
<part element="s0:XacuteResponse" name="parameters" />
</message>
- <!-- Ports
-->
- <portType name="XacuteWSSoap">
- <operation name="Xacute">
<input message="s0:XacuteSoapIn" />
<output message="s0:XacuteSoapOut" />
</operation>
</portType>
- <!-- Bindings
-->
- <binding name="XacuteWSSoap" type="s0:XacuteWSSoap">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="Xacute">
<soap:operation soapAction="http://www.sap.com/xMII" style="document" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <!-- Service mapping
-->
- <service name="XacuteWS">
- <port binding="s0:XacuteWSSoap" name="XacuteWSSoap">
<soap:address location="http://naholldo31020/Lighthammer/SOAPRunner/Amy/GetListOfPlants" />
</port>
</service>
</definitions>Hi Amy,
here is an example how you can call a WS via http GET:
http://<server>/Lighthammer/Runner?Transaction=<path_to_your_TRX>&XacuteLoginName=YourAccount&XacuteLoginPassword=yoursecret&outputparameter=*
Please note you do not need to use credentials in case you calling localhost.
I think in your case this should be the right url:
http://naholldo31020/Lighthammer/Runner?Transaction=Amy/GetListOfPlants&XacuteLoginName=YourAccount&XacuteLoginPassword=yoursecret&outputparameter=*
Please change parameters for
- XacuteLoginName
- XacuteLoginPassword
- outputparameter (you can specify * or one of your transaction output parameter) -
How to add exactly 2 NON XML caracters at the end of a SOAP body
Hello all I am trying to add two (and only two) extra non xml caracters "AA" at the END of a SOAP body using the JAXWS handlers as so:
HTTP/1.1 200 OK
Content-Type: text/xml;charset=UTF-8
Content-Length: 131
Content-Length: 131
Server: Jetty(7.x.y-SNAPSHOT)
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body></SOAP-ENV:Body></SOAP-ENV:Envelope>
AA
The problem is that if you try to add them to the SOAP body (see code below) you get a XML Unmarshalling exception. If I add "AA" as a soap attachment I get MORE than 2 caracters after the SOAP body (which I don't want)
Here is the my SOAPHandler code :
@Override
public boolean handleMessage(SOAPMessageContext mc) {
if (Boolean.TRUE.equals(mc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY))) {
try {
SOAPMessage message = context.getMessage()
String stringSoapMessage= getMsgAsString(message);
stringSoapMessage += "ss";
message.getSOAPPart().setContent((Source) new StreamSource(new ByteArrayInputStream(msg.getBytes())));
message.saveChanges();
context.setMessage(message);
} catch (Exception e1) {
return true;
public String getMsgAsString(SOAPMessage message) throws SOAPException {
String msg = null;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.writeTo(baos);
msg = baos.toString();
} catch (Exception e) {
e.printStackTrace();
return msg;
so my question is this: is there any way to add exactly 2 non xml caracters at the end of the soap body using jaxws handlers ? I have spent several weeks on this so it is not an easy question...
Thanks,
Fred.Yes I have done it using CFX interceptors. But the runtime dependencies needed were too big for this particular use. I mean having to use these:
apache/cxf/cxf-bundle/2.6.0/cxf-bundle-2.6.0.jar
org/apache/neethi/neethi/3.0.2/neethi-3.0.2.jar
wsdl4j/wsdl4j/1.6.2/wsdl4j-1.6.2.jar
/org/codehaus/woodstox/wstx-asl/3.2.4/wstx-asl-3.2.4.jar
org/apache/ws/xmlschema/xmlschema-core/2.0.2/xmlschema-core-2.0.2.jar
org/mortbay/jetty/jetty-util/6.0.2/jetty-util-6.0.2.jar
org/eclipse/jetty/jetty-util/7.5.4.v20111024/jetty-util-7.5.4.v20111024.jar
org/apache/geronimo/specs/geronimo-servlet_2.5_spec/1.1.2/geronimo-servlet_2.5_spec-1.1.2.jar
org/apache/geronimo/specs/geronimo-javamail_1.4_spec/1.7.1/geronimo-javamail_1.4_spec-1.7.1.jar
org/apache/geronimo/specs/geronimo-servlet_3.0_spec/1.0/geronimo-servlet_3.0_spec-1.0.jar
org/eclipse/jetty/jetty-http/7.5.4.v20111024/jetty-http-7.5.4.v20111024.jar
org/eclipse/jetty/jetty-server/7.5.4.v20111024/jetty-server-7.5.4.v20111024.jar
org/eclipse/jetty/jetty-io/7.5.4.v20111024/jetty-io-7.5.4.v20111024.jar
org/eclipse/jetty/jetty-continuation/7.5.4.v20111024/jetty-continuation-7.5.4.v20111024.jar
to add two caracters at the end of a soap message seems like over kill. If this is the only way to do this then i'll do it this way but it just seems like the implementation of the JAXWS API in JDK 6 seems inches away from being able to do this no ?
Thanks for the replies,
Fred -
How can I attach a document to an email as an attachment that doesn't appear in the body of the text
When I send an email and attach a document it pastes it into the text. How do I send it as a separate attachment?
Control+Click or Right Click on the attachment within the body of the email and select 'view as icon'. Also make sure 'Send Windows-friendly attachments' is selected in Mail>Edit>Attachments menu.
There is a (paid for) plug in available called Attachment Tamer that will make this the default behaviour and generally help Mail to make attachments more compatible across computer platforms.
http://lokiware.info/Attachment-Tamer (disclaimer: no connection with the company just happy with their product - it works well). -
Hi All,
We have a scenario of FTP-->PI---> Webservice. While triggering the data in the FTP, it is failing in the PI with the below error
SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: Server was unable to read request. ---> There is an error in XML document (1, 447). ---> Input string was not in a correct format.
Can you please help?Hi Raja- It seems to be a data quality issue.
Check for the value @ 1447 position in the xml message that you are trying to send to web service..
may be a date filed/decimal value which is not in expected format. -
My wife wrote her resume. Wants to email it as an attachment only. But whenever it is received it comes as an attachment and as an open document in the body of the email. How do we stop the resume from opening in the body of the email?
wyman41 wrote:
She wrote her resume in Word.
I don't have any problem attaching just a MS Word file in Mail. My process is pretty simple....with a message open I click the attach icon (paperclip) at the top of the message, then navigate to where the file is located and select it. I make sure I have the cursor at the bottom of the new message below my signature line. FWIW I use MS Word 2011. -
Critical Issue:-- Convert SOAP Attachment into SOAP Body
hi,
My requirment is
FTP----> SOAP synchronous.
In this one at SOAP receiver side SOAP request is an attachment file and response also I m getting as an attachment.
My problem is that I need to convert this SOAP response (attachment) in SOAP body so that I can map it with FTP datatype.
I used PayLoadSwapBean module but i m unable to convert this attachment into SOAP Body.
I just followed this blog
The specified item was not found.
May be i m not using this module in a proper mannner.
Can anybody explan it step by step.
Is there anyother solution for my problem..
<It is against the rules of Engagement to post a question with the catch of awarding points. Please refrain from the same.>
Thanks
Jaideep Jain
Edited by: Bhavesh Kantilal on Dec 3, 2008 10:26 AMhi stefan,
I m getting this error after using PayloadSwapBean.
com.sap.aii.af.ra.ms.api.DeliveryException: Object not found in lookup of payloadSwapBean
I m mentioning here the value of parameter name and value for this module:--
parameter name parameter value
swap.keyName payload-name
swap.keyValue MainAttachment
Can u suggest where i went wrong.....
Thanks
Jaideep
Edited by: Jaideep Baid on Dec 5, 2008 9:27 AM -
Convert SOAP Attachment into SOAP Body
Hi,
I am getting the response from external system through SOAP attachment, how to convert it into soap body.
Is there any other alternative apart from PayloadSwapBean, if not, let me know the steps of the same.
Regards,
B.AnandhHi Krish,
It is not possible to use adapter module (Custom or standard) in SOAP sender adapter and this thing is clearly mentioned in Help.sap.
But you can use axis adapter to use module (Axis adapter is extention to soap adapter). It provides modules which are flexible enough to fulfil your requirment.
If you are using Receiver SOAP adapter then youn can either have PayloadSwipeBean or your own adapter module. And it is possible to convert the attachment to the payload using custom module.(I have Done this)
There is method available getAttachment() of type. Just Check API.
Thanks
Sunil Singh -
Hi,
how can I get the body content of SOAP messages in XML format?
I have a service that get as input a XML string, I want to create a Web Service, with this service, without change all but I have not understand how take the XML to give it to the old service.
TIA
AslasYou should check out the following in details. It
explains to you how soap works and how you can
implement a listener to retrieve the XML doc in
the body.
http://xml.apache.org/soap/docs/index.html
Amlan -
Receiving XML document and getting attachment via URL
What is the best method to retrieve a file from a provided URL. Here is the scenario. A system will send us an XML document via an HTTP post but the source system is unable to send us the associated attachment as a MIME attachment instead in the XML they will include a extra node with the URL to a file we need to get. What is the ideal method of retrieving this file once we receive the XML message. If the provided link was an ftp site we would hold the message in BPM and use the file adapter but since this is a full url such as http://someserver.com/myfile/file.doc we are looking for the best approach. On thought was a Java Proxy.
RegardsHi,
there are just two approaches:
easy one - java proxy
more diffcult - creating sync adapter for http xmls
I'd go for java proxy (if possible from secutiry point of view)
as you will have the link (so no "adapter configuration" necessary in your case)
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Get SOAP Cannot Create XML Document reader error with Outlook integration?
Hi,
We installed Outlook Email Integration on a windows XP / Office 2007 machine and it installed OK. However when we click the "Add to CRM On Demand" button and try to login we get the following error message when we click the 'Sign In" button
"SOAP: Cannot create XML document reader"
Has anyone come across this? Are there any pre-requisites for using this add-in? e.g. Service Packs, .NET framework etc?
CheersIt may not be the case...but pls. check if MS Word is defined as editing tool for email.. It should not be.
ANotnio
BExpert, Brazil -
How to get the HTTP response body if the body is a malformed XML document
Hi,
I am using HTTP service with resultFormat = "e4x" set. What i
get in response is a malformed XML document in
some cases. Usually HTTPService throws a FaultEvent with the
fault detail set to faultCode:Client.CouldNotDecode
faultString:'Error #1091' or some other Error #1085 and so.
My client tries to log these errors on the server by using
another HTTP service again. But i would like to know
in the client code during run time what exact XML response
came in the first HTTP response.
How do i retrieve this information?
thanks,
Sunilservice capture or charles debug proxy can do the job.
flex builder 4 is rumored to include a traffic sniffer as
well, but that's next year.
Maybe you are looking for
-
hi is there any report for Like Reqno, budget,commitment and actul value Raj Edited by: Chowdary Dmm on Dec 13, 2008 6:51 AM
-
Previously, after connecting my IPHONE 4 to the computer and loading/syncing, I could edit my downloads. Now, I can't seem to find a list of what is actually on my phone. Who says new is always better -- not in this case. HELP!
-
Problems with the system decimal point with german regional settings
I have a Labview 6 app that needs deploying to Germany. My app sends strings over VISA RS232 and GPIB instruments with floating point numbers. When changing from English to German regional settings, in Windows XP, periods are now interpreted as comma
-
Does anyone know if OS X has a built-in ftps (not sftp) client? Also, is there a list of supported protocols for "connect to server"? Thanks!
-
CUCM 7.1.3 We have users that forward their extsnions to their mobile telephones. The caller number transfers to the mobile but not the CALLER NAME. Is there some configuration to accomplish this?.