Reformat XML SOAP Response
Hi,
I am creating a CF component that calls a Web service and I
would like to reformat the result. I do not have access to the
service provider to make changes so I have to make the conversion
on the client side.
The result from the service returns the field definitions for
every element then the actual data values follow. Here is an
example of the XML sent back from the service only showing two
elements.
<fieldDefinitions>
<fieldName>NAME1</fieldName>
<fieldType>STRING</fieldType>
<fieldLength>20</fieldLength>
</fieldDefinitions>
<fieldDefinitions>
<fieldName>NAME2</fieldName>
<fieldType>STRING</fieldType>
<fieldLength>40</fieldLength>
</fieldDefinitions>
<dataRows>
<value>John</value>
<value>Doe</value>
</dataRows>
I would like to reformat the XML to make the value of the
<fieldName> as the element tag then put the actual value
inside the tag. Something like this.
<name1>John</name1>
<name2>Doe</name2>
I am not exactly sure what the best method would be to
accomplish this, using the XmlNew function or maybe transforming
the output with a style sheet (XSLT).
Any suggestions would be helpful.
Thanks,
Chris
The SOAP message minus the mime headers(i.e. Content-length) is an xml file. You can parse this file using a SAX or DOM parser. The soap message will be on the request input stream. Read the soap message into a string and then create an inputSource of this string, then use a sax parser to parse this input. You can write a contenthandler to look for certain element tags and extract its content which you can then place in the response output stream. For details on using sax look at java.sun.com/xml for the xml tutorial.
hope this helps.
Similar Messages
-
How can i custom the xml soap response in my ws?
Hello there,
Im developing a ws in weblogic 10.2 and i need to return a complex type soap response with a custom xml created by me... can any one give me an advice on how can i do that? Im not used to soap ws
And i need to return a lot of info some times and some of them are ArrayList of an object. Like the info of a Client and all the contracts of this client (and the info of that contract)... a lot of xml element with childs.
Thanx in advance for any help
PS. I tried to post an xml as example but i couldnt do it using '{' code '}' tag
Edited by: mgaldames on 08-dic-2010 8:50Hi Riyaz,
Thanks for your immediate response.
Here is my requirement.
I have created a ZTABLE with Field AUART and this table is maintain table using SM30.
When I Press F4, it will giving the list of all the order types available in T003O table and can select one and I can proceed succussfully.
But when using SM30 I need to give '*' in the column for AUART which is not available in T003O table.
I need to save my entires for AUART with * also( The value "*" is not available in Check table T003O ).
Please let me know how can I do this.
Thanks in advance. -
An XML / SOAP response to interprete ?
hi all
i have a simple class that call a webservice and gets back an xml response, with SOAP.
here is a sample :
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<BonjourResponse xmlns="http://tempuri.org/">
<BonjourResult>Bonjour string</BonjourResult>
</BonjourResponse>
</soap:Body>
</soap:Envelope>
i just want to get the string sent in the response (between the <BonjourResult> tags)
what should i do to treat this xml ?
for the moment i retrieve this xml this way :
URL endpoint = new URL("http://val1nt10/PCS_Integration/SynchronizeProfiles.asmx");
URLConnection con = endpoint.openConnection ();
con.setDoInput (true);
con.setDoOutput (true);
con.setUseCaches (false);
con.setAllowUserInteraction(false);
con.setRequestProperty ("Content-Length", Integer.toString (request.length));
con.setRequestProperty ("Content-Type", "text/xml; charset=utf-8");
con.setRequestProperty ("SOAPAction", "\"http://tempuri.org/Bonjour\"");
OutputStream out = con.getOutputStream ();
out.write (request);
out.flush ();
out.close();
InputStream in = con.getInputStream();
regards,The SOAP message minus the mime headers(i.e. Content-length) is an xml file. You can parse this file using a SAX or DOM parser. The soap message will be on the request input stream. Read the soap message into a string and then create an inputSource of this string, then use a sax parser to parse this input. You can write a contenthandler to look for certain element tags and extract its content which you can then place in the response output stream. For details on using sax look at java.sun.com/xml for the xml tutorial.
hope this helps. -
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. -
I work with SOA 10.1.3.3 (Patched).
When I call an ESB Routing Service from BPEL, are generated an exception as follow:
<messages><input><WBPM_IKSelectDatiTx_in><part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WBPM_DASelectDatiTxSelect_pn_prog_tx_inparameters"><WBPM_DASelectDatiTxSelect_pn_prog_txInputParameters xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/top/WBPMDASelectDatiTx">
<pn_prog_tx>3</pn_prog_tx>
</WBPM_DASelectDatiTxSelect_pn_prog_txInputParameters>
</part></WBPM_IKSelectDatiTx_in></input><fault><remoteFault xmlns="http://schemas.oracle.com/bpel/extension"><part name="summary"><summary>exception on JaxRpc invoke: HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: javax.xml.soap.SOAPException: Bad response: 404 Not Found</summary>
</part></remoteFault></fault></messages>
I've already read the metalink note 427452.1 and I tried the 2 way indicated to solve this problem. But the problem persist.
In the ESB console the Web Services considered above:
WSDL URL http://wise-svr1.wise.com:7777/esb/slide/ESB_Projects/AppWBPMCicloPassivo_ESB_WBPMCicloPassivo/WBPM
URI endpoint SOAP http://wise-svr1.wise.com:7777/event/DefaultSystem/WBPM_DASelectDatiTx
When I click on WSDL URL explorer open an XML file
When I click on URI endpoint SOAP explorer result "Page not Found"
Thanks in advance
UmbertoHi,
Your problem is with the esb service since calling the endpoint in a browser should result in a test interface for the esb service. Do you have any errors in the logfiles after deploying or calling the endpoint? ($ORACLE_HOME\j2ee\oc4j_soa\log\oc4j_soa_default_group_1\oc4j\log.xml
Kind Regards,
Andre -
Soap response Error when processing XML CF.
Hello,
I have problems with soap response and wondered if you could give some advice.
Every time I send my message via soap I get the following error:
com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Error when processing XML CF.
Is it possible that the communication is aborted and my response message mapping is never started?
(Additional info: I tried to create an integration process and am not able to evaluate the response.)
Thanks a lot for your help.
Regards,
Juliahi,
do you see any more error details in :
http://xiserver:port/MessagingSystem/monitor
did you check logs in visual admin ?
>>>>Is it possible that the communication is aborted and my response message mapping is never started?
yes - if the response is not ok the mapping may not be started
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> -
How to set XML character encoding for a SOAP response?
Hi,
We're using Oracle J2EE web services,
and are quite happy with them.
However, it's a problem that we need to have
characters outside the standard English alphabet
in our service responses. So far, we have not been
able to find a way to specify what encoding to use.
Our version (9.0.3 release) produces SOAP-responses
without any encoding specification in the XML header.
Any ideas?Hello,
If you are using the "Paper Layout", check the Reports's "Before Report Value" property:
Before Report Value :
<meta http-equiv="Content-Type" content="text/html; charset=&Encoding">
If you are using the "Web Layout", take a look to the document :
http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b14048/pbr_nls.htm#i1006142
18.3 Specifying a Character Set in a JSP or XML File
Regards -
Hi,
I wrote my own SOAP web service and so far it is working like a charm. I am trying now to use it in my own iPhone app but I keep getting the SOAP response as HTML entities (< become <) and I can not parse the XML like that.
I think the reason for this is that I specified on the SOAP WSDL that the response will be an string:
<part name='Result' type='xsd:string'/>
I can still modify my SOAP if I have to. What type of response should I use to avoid the HTML entities on my response?
Thank you.Hi,
Thank you for your response.
The SOAP response headers are coming back in their proper XML format, but I am expecting an string that is an XML list (beside the SOAP headers) and that is what is being converted.
My suspicion is that I should declare a simple type just for XML and not treat it like an string. Your thoughts?
<SOAP-ENV:Body>
<ns1:getPartsResponse>
<Result xsi:type="xsd:string">
<catalog>
<result id="1">
<part>AAAAAAAAAAA</part>
<qty>0000000000</qty>
<mfg>XXXXXXXXXXXXX</mfg>
</result>
</catalog>
</Result>
</ns1:getPartsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope> -
Unmarshal SOAP response, as raw XML String with JAXB
Hi,
I have a soap response, as raw xml (a java.lang.String), and I want to unmarshal it's content into the classes generated by wsimport.
This must be a simple task but I couldn't find a way to do it.
Can someone tell me how I can achieve this ?
Edited by: Raphael_Lemaire on May 25, 2010 8:30 AMRaphael_Lemaire wrote:
Yes it works this way.
I kind of hoped that i could use a jax-ws api to shorten the code.well, how exactly do you get that string full of xml? (as a side note, you need to be careful turning xml into strings, the data can easily broken if you don't translate the bytes into characters correctly). if you use the jaxws api to make soap calls, then you don't really need to deal with the xml at all.
Edited by: jtahlborn on May 26, 2010 7:38 AM -
BPEL process to create a PDF and send it as attachment in SOAP response
We have a requirement to have a webservice created using BPEL, which can receive input from a client and create a PDF using the input and send the PDF as attachment in the SOAP response.
We have found the below link in Oracle docs and our basic understanding on the functionality given is that the MIMEService is being used to read a SOAP attachment from some other service and send it as an attachment in the SOAP response to the requester. As explained above, this doesn't completely satisfy our requirement.
http://docs.oracle.com/cd/E11036_01/integrate.1013/b28981/manipdoc.htm#BABCJIAH
Please suggest if there is any other approach that suites our requirement.
Thanks.Hi,
I have a Weblogic webservice which returns me a PDF attachment as resposne ( here I have MIME related stuff).I need to get attachment as bpel response.
I have created a BPEL process to invoke the weblogic webservice. I have explictly added the MIME part in bpel.wsdl same as weblogic webservice wsdl.
I tried to assign the response variable( of type base64binary) of bpel.wsdl and my webservice .wsdl . I am getting some error with no attachment.
Below is my xsd used in BPEL.wsdl*
<?xml version="1.0" encoding="UTF-8"?>
<schema attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://xmlns.oracle.com/MIMEApp/test/BPELProcess1"
xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="process">
<sequence>
<element name="input" type="string"/>
</sequence>
</complexType>
<complexType name="processResponse">
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
<complexType name="GetAttachmentPDF">
<sequence>
<element minOccurs="0" name="Pdf" nillable="false" type="base64Binary"/>
</sequence>
</complexType>
</schema>
Below is my BPEL.wsdl*
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="BPELProcess1"
targetNamespace="http://xmlns.oracle.com/MIMEApp/test/BPELProcess1"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:client="http://xmlns.oracle.com/MIMEApp/test/BPELProcess1"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/">
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TYPE DEFINITION - List of services participating in this BPEL process
The default output of the BPEL designer uses strings as input and
output to the BPEL Process. But you can define or import any XML
Schema type and use them as part of the message types.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://xmlns.oracle.com/MIMEApp/test/BPELProcess1"
schemaLocation="xsd/BPELProcess1.xsd"/>
</schema>
</wsdl:types>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MESSAGE TYPE DEFINITION - Definition of the message types used as
part of the port type defintions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<wsdl:message name="BPELProcess1RequestMessage">
<wsdl:part name="payload" type="client:process"/>
</wsdl:message>
<wsdl:message name="BPELProcess1ResponseMessage">
<wsdl:part name="payload" type="client:processResponse"/>
<wsdl:part name="attachment" type="client:GetAttachmentPDF"/>
</wsdl:message>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PORT TYPE DEFINITION - A port type groups a set of operations into
a logical service unit.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- portType implemented by the BPELProcess1 BPEL process -->
<wsdl:portType name="BPELProcess1">
<wsdl:operation name="process">
<wsdl:input message="client:BPELProcess1RequestMessage"/>
<wsdl:output message="client:BPELProcess1ResponseMessage"/>
</wsdl:operation>
</wsdl:portType>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PARTNER LINK TYPE DEFINITION
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<plnk:partnerLinkType name="BPELProcess1">
<plnk:role name="BPELProcess1Provider">
<plnk:portType name="client:BPELProcess1"/>
</plnk:role>
</plnk:partnerLinkType>
<wsdl:binding name="BPELProcess1SOAP11Binding" type="client:BPELProcess1">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="process">
<soap:operation style="rpc"
soapAction="http://xmlns.oracle.com/MIMEApp/test/BPELProcess1/process"/>
<wsdl:input>
<soap:body use="literal"
namespace="http://xmlns.oracle.com/MIMEApp/test/BPELProcess1"/>
</wsdl:input>
<wsdl:output>
<mime:multipartRelated>
<mime:part>
<soap:body use="literal"
namespace="http://xmlns.oracle.com/MIMEApp/test/BPELProcess1"/>
</mime:part>
<mime:part>
<mime:content part="attachment" type="application/pdf"/>
</mime:part>
</mime:multipartRelated>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
</wsdl:definitions>
Below is my WL WS WSDL*
<?xml version="1.0" encoding="UTF-8"?>
<WL5G3N0:definitions
name="NewWSDLFile"
targetNamespace="http://www.example.org/NewWSDLFile/"
xmlns:WL5G3N5="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:WL5G3N4="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:WL5G3N3="http://www.example.org/NewWSDLFile/"
xmlns:WL5G3N2="java:com.rogers.service"
xmlns:WL5G3N0="http://schemas.xmlsoap.org/wsdl/"
xmlns:WL5G3N1="http://www.w3.org/2001/XMLSchema"
>
<WL5G3N0:types>
<xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="java:com.rogers.service"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="java:com.rogers.service"
xmlns:s0="http://schemas.xmlsoap.org/wsdl/" xmlns:s1="http://www.w3.org/2001/XMLSchema"
xmlns:s2="java:com.rogers.service" xmlns:s3="http://www.example.org/NewWSDLFile/"
xmlns:s4="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s5="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/NewWSDLFile/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="GetAttachmentPDF">
<xsd:sequence>
<xsd:element minOccurs="0" name="Pdf" nillable="false" type="xs:base64Binary"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="GetAttachmentResult">
<xsd:sequence>
<xsd:element minOccurs="1" name="Message" nillable="true" type="xs:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</WL5G3N0:types>
<WL5G3N0:message name="NewOperationRequest">
<WL5G3N0:part name="GetAttachment" type="WL5G3N1:string"/>
</WL5G3N0:message>
<WL5G3N0:message name="NewOperationResponse">
<WL5G3N0:part name="NewOperationResponse" type="WL5G3N2:GetAttachmentResult"/>
<WL5G3N0:part name="attachment" type="WL5G3N2:GetAttachmentPDF"/>
</WL5G3N0:message>
<WL5G3N0:portType name="NewWSDLFile">
<WL5G3N0:operation name="NewOperation">
<WL5G3N0:input message="WL5G3N3:NewOperationRequest"/>
<WL5G3N0:output message="WL5G3N3:NewOperationResponse"/>
</WL5G3N0:operation>
</WL5G3N0:portType>
<WL5G3N0:binding name="NewWSDLFileSOAP" type="WL5G3N3:NewWSDLFile">
<WL5G3N4:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<WL5G3N0:operation name="NewOperation">
<WL5G3N4:operation soapAction="http://www.example.org/NewWSDLFile/NewOperation"/>
<WL5G3N0:input>
<WL5G3N4:body use="literal" namespace="http://www.example.org/NewWSDLFile/"/>
</WL5G3N0:input>
<WL5G3N0:output>
<WL5G3N5:multipartRelated>
<WL5G3N5:part>
<WL5G3N4:body use="literal" namespace="http://www.example.org/NewWSDLFile/"/>
</WL5G3N5:part>
<WL5G3N5:part>
<WL5G3N5:content part="attachment" type="application/pdf"/>
</WL5G3N5:part>
</WL5G3N5:multipartRelated>
</WL5G3N0:output>
</WL5G3N0:operation>
</WL5G3N0:binding>
<WL5G3N0:service name="NewWSDLFile">
<WL5G3N0:port name="NewWSDLFileSOAP" binding="WL5G3N3:NewWSDLFileSOAP">
<WL5G3N4:address location="http://localhost:7001/something/NewWSDLFileImpl"/>
</WL5G3N0:port>
</WL5G3N0:service>
</WL5G3N0:definitions>
I refered the below link:
http://docs.oracle.com/cd/B14099_19/integrate.1012/b14448/manipdoc.htm.
4.16.1.1 WSDL File Contents
They are using ra:writeBinaryToFile() and ora:ReadBinaryFromFile(). I couldnt get a proper sample to understand the use of these functions.
Please advise.
Regards
Ipsita -
Oracle ESB 10g : Blank namespace in the SOAP Response from DB adapter
Hi All,
I am currently working on a ESB project to route input XML file as a parameter to a DB Function.
This Function has a input parameter of type XMLTYPE and returns VARCHAR2 values.
I have configured the DB Adapter to invoke this function and return the result as a SOAP response.
The WSDL of DB adapter contains XML_DATA as input and XMLMAIN as the output result.
The ESB project works fine as expected. But in the result from DB adapter contains a blank namespace [xmlns=""] for the XMLMAIN element .
I hereby attach the output XML.
Please help how to remove this blank namespace from the output.
We are using SOA Suite 10g 10.1.3.5
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/XXWEB/XMLMISCRCPTINSERTPKG/XMLMAIN/">
<OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<XMLMAIN xmlns="">100</XMLMAIN>
</OutputParameters>
</env:Body>
</env:Envelope>
Thanks and Regards,
Justin Michael Rajwell..the problem is..the db adapter has it's own transaction..so the transactions fails or not.
you're just not capable of checking if the transaction went ok...and return 'process completed ok' or when the transaction failed for some reason return 'the process aborted'.
So you just need some extra steps for it to be able to return some response-message -
SOAP Response XSLT Transformation Error
I am doing a webservice call and trying to transform the SOAP Response using XSLT.
I am getting the following error when the command CALL TRANSFORMATION Executes.
The element abap was expected for the XML-ABAP transformation
Please let me know if anyone ave received this error before and how did you solve it.
Regards
Sudhir AtluruHi Petra
for this Error com.sap.aii.af.ra.ms.api.ConfigException
check this Link
experts needed! com.sap.aii.af.ra.ms.api.ConfigException
http://help.sap.com/saphelp_nw04s/helpdata/en/78/20244134a56532e10000000a1550b0/frameset.htm
also refer SAP Note 978606
Regards
Abhishek -
Hi
My PI server is able to make a soap call to the SFDC ( webservice ) ...however the response that is received within PI
has a SOAP envelope...and hence the response mapping is going in error....because the source data type in response mapping doesnot match with the soap response ( with envelope )
<?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com">
- <soapenv:Body>
- <upsertResponse>
- <result>
<created>false</created>
<id>a0UT0000004aeaMMAQ</id>
<success>true</success>
</result>
</upsertResponse>
</soapenv:Body>
</soapenv:Envelope>
how do i handle thisHi,
I think there is an option while configuration of SOAP adapter, where you can define, not to keep SOAP envelop. Please check the option Conversion Parameters\Do Not Use SOAP Envelope and set it as per your requirement. That might solve the problem. Here is the link which can be helpful
http://help.sap.com/saphelp_nw04/helpdata/en/29/5bd93f130f9215e10000000a155106/content.htm
Alternatively you need a java mapping or XSLT mapping to remove the envelop.
Here is the java mapping code to remove SOAP envelop
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
public class RemoveSoapEnvelop implements StreamTransformation{
public void execute(InputStream in, OutputStream out)
throws StreamTransformationException {
try
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
DocumentBuilder builderel=factory.newDocumentBuilder();
/*input document in form of XML*/
Document docIn=builderel.parse(in);
/*document after parsing*/
Document docOut=builderel.newDocument();
TransformerFactory tf=TransformerFactory.newInstance();
Transformer transform=tf.newTransformer();
Element root;
Node p;
NodeList l;
int mm,n1;
//if you need to include namespace use next two lines
//root=docOut.createElement("ns0:upsertResponse");
//root.setAttribute("xmlns:ns0","http://connectsystems.be/MAINFR/AccDocument");
root=docOut.createElement("upsertResponse");
p=docIn.getElementsByTagName("upsertResponse").item(0);
l=p.getChildNodes();
n1=l.getLength();
for(mm=0;mm<n1;++mm)
Node temp=docOut.importNode(l.item(mm),true);
root.appendChild(temp);
docOut.appendChild(root);
transform.transform(new DOMSource(docOut), new StreamResult(out));
catch(Exception e)
e.printStackTrace();
public void setParameter(Map arg0) {
public static void main(String[] args) {
try{
RemoveSoapEnvelop genFormat=new RemoveSoapEnvelop();
FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\sd2.xml");
FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\removedEnvelop.xml");
genFormat.execute(in,out);
catch(Exception e)
e.printStackTrace();
input xml file sd2.xml
<?xml version="1.0" encoding="UTF-8" ?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:enterprise.soap.sforce.com">
<soapenv:Body>
<upsertResponse>
<result>
<created>false</created>
<id>a0UT0000004aeaMMAQ</id>
<success>true</success>
</result>
</upsertResponse>
</soapenv:Body>
</soapenv:Envelope>
Here is the output xml removedEnvelop.xml
<?xml version="1.0" encoding="UTF-8" ?>
<upsertResponse>
<result>
<created>false</created>
<id>a0UT0000004aeaMMAQ</id>
<success>true</success>
</result>
</upsertResponse>
Helpful articles on java mapping for PI 7.1
http://wiki.sdn.sap.com/wiki/display/XI/SampleJAVAMappingcodeusingPI7.1+API
You can also try following XSLT mapping to get the same output as java mapping
<xsl:stylesheet version="1.0"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
exclude-result-prefixes="SOAP-ENV">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
<xsl:template match="/">
<xsl:for-each select="SOAP-ENV:Envelope/SOAP-ENV:Body">
<upsertResponse>
<result>
<xsl:variable name="var" select="normalize-space(.)"></xsl:variable>
<xsl:variable name="tokenizedSample" select="tokenize($var,' ')"/>
<created><xsl:value-of select="$tokenizedSample[1]"/></created>
<id><xsl:value-of select="$tokenizedSample[2]"/></id>
<success><xsl:value-of select="$tokenizedSample[3]"/></success>
</result>
</upsertResponse>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Other than these please refer to following links for further examples on the topic
Remove SOAP-ENV tags from xml RECEIVER RESPONSE payload (XSL needed?)
Remove SOAP Envelop using XSLT mapping.
Hope this helps your cause.
regards
Anupam -
HI Experts,
Here my scenario is RFC PI SOAP synchronous interface. While sending the message from PI receiver system is expeting SAOP envelop I added this envelop with xslt mapping. Even response message is coming with SOAP envelop I removed with Xslt.. now I am getting below error message in response:
*Here i am not using any authoentication. it is not required..*
In SXMB_moni:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--
Inbound Message
-->
- <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SAP:Category>XIAdapterFramework</SAP:Category>
<SAP:Code area="MESSAGE">GENERAL</SAP:Code>
<SAP:P1 />
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 401 Unauthorized</SAP:AdditionalText>
<SAP:Stack />
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
In communication channel:
Description
23.11.2011 14:45:11.557 Information The message was successfully received by the messaging system. Protocol: XI URL: http://r3vidci.got.volvo.net:52000/MessagingSystem/receive/AFW/XI Credential (User): PIISUSER
23.11.2011 14:45:11.564 Information Using connection SOAP_http://sap.com/xi/XI/System. Trying to put the message into the request queue.
23.11.2011 14:45:11.568 Information Message successfully put into the queue.
23.11.2011 14:45:11.572 Information The message was successfully retrieved from the request queue.
23.11.2011 14:45:11.573 Information The message status was set to DLNG.
23.11.2011 14:45:11.577 Information Delivering to channel: SOAP_Receiver_BOSS_VID
23.11.2011 14:45:11.577 Information MP: entering1
23.11.2011 14:45:11.579 Information MP: processing local module localejbs/AF_Modules/MessageTransformBean
23.11.2011 14:45:11.599 Information Transform: using Transform.Class: $identity
23.11.2011 14:45:11.634 Information Transform: transforming the payload ...
23.11.2011 14:45:11.637 Information Transform: successfully transformed
23.11.2011 14:45:11.638 Information MP: processing local module localejbs/sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean
23.11.2011 14:45:11.676 Information SOAP: request message entering the adapter with user J2EE_GUEST
23.11.2011 14:45:11.695 Information SOAP: completed the processing
23.11.2011 14:45:11.696 Information SOAP: continuing to response message bf2ba0ac-15e1-11e1-cc01-00000c601d4e
23.11.2011 14:45:11.696 Error SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 401 Unauthorized
23.11.2011 14:45:11.698 Error MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 401 Unauthorized
23.11.2011 14:45:11.699 Error Adapter Framework caught exception: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 401 Unauthorized
23.11.2011 14:45:11.700 Error Delivering the message to the application using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 401 Unauthorized. Setting message to status failed.23.11.2011 14:45:11.704 Error The message status was set to FAIL.Hi Rajesh,
I tried with XMLSPY.. i am able to send and get the responce witout any authentication.. I gone through vijay's blog... but i din't find any solution in that..
one more thing.. here inteface is sending from SAP portal system > SAP ECC> SAPI--> webservice(Microsoft system). whenever Portal team sending the message to SAP they are getting below error"
call to messaging system failed: com.sap.engine.interfaces.messaging.api.exception.MessagingException: XIAdapterFramework:GENER
In PI I am getting below error:
.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 401 Unauthorized -
Presence of multiref tag in soap response message
We are having a problem when we try to call a web service in PI. The web services called is provided by an Axis server.
We tried to use the plain HTTP protocol in the definition of the communication channel as shown here:
Adapter type: SOAP
Transport protocol: HTTP
Message protocol: SOAP 1.1
Adapter engine: Central Adapter Engine
We got the followong error response in SXMB_MONI:
The payload shown in SXNB_MONI is:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!-- XML Validation Inbound Channel Response -->
<ns1:cedstr_obt_cle_elem_v2_Response xmlns:ns1='urn:CEDSTR' soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<tab_cle soapenc:arrayType='ns1:cedstr_cle_elem_v1[3]' xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xsi:type='soapenc:Array'>
<item href='#id0'/>
<item href='#id1'/>
<item href='#id2'/>
</tab_cle><nb_cle xsi:type='xsd:int'>3</nb_cle><stat_elem href='#id3'/>
<cdr href='#id4'/>
</ns1:cedstr_obt_cle_elem_v2_Response>
The expected payload is:
<?xml version="1.0" encoding="UTF-8" ?>
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <soapenv:Body>
- <ns1:cedstr_obt_cle_elem_v2_Response soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:CEDSTR">
- <tab_cle xsi:type="soapenc:Array" soapenc:arrayType="ns1:cedstr_cle_elem_v1[3]" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<item href="#id0" />
<item href="#id1" />
<item href="#id2" />
</tab_cle>
<nb_cle xsi:type="xsd:int">3</nb_cle>
<stat_elem href="#id3" />
<cdr href="#id4" />
</ns1:cedstr_obt_cle_elem_v2_Response>
- <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns2:cedstr_cle_elem_v1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:CEDSTR">
<id_structure_det xsi:type="xsd:int">118406</id_structure_det>
<ordinal xsi:type="xsd:int">2648545</ordinal>
<appareil xsi:type="xsd:string">C3D1E</appareil>
<type_cable xsi:type="xsd:string">H</type_cable>
</multiRef>
- <multiRef id="id1" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:cedstr_cle_elem_v1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns3="urn:CEDSTR">
<id_structure_det xsi:type="xsd:int">984806</id_structure_det>
<ordinal xsi:type="xsd:int">2723425</ordinal>
<appareil xsi:type="xsd:string">O5C3X</appareil>
<type_cable xsi:type="xsd:string">H</type_cable>
</multiRef>
- <multiRef id="id2" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:cedstr_cle_elem_v1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns4="urn:CEDSTR">
<id_structure_det xsi:type="xsd:int">1163686</id_structure_det>
<ordinal xsi:type="xsd:int">3144641</ordinal>
<appareil xsi:type="xsd:string">Y0A6B</appareil>
<type_cable xsi:type="xsd:string">H</type_cable>
</multiRef>
- <multiRef id="id3" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:cedstr_stat_elem_v1" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns5="urn:CEDSTR">
<tension xsi:type="xsd:string">MT</tension>
<nb_concess xsi:type="xsd:int">0</nb_concess>
<nb_restr xsi:type="xsd:int">0</nb_restr>
<localisation xsi:type="xsd:string">DEVILLERS EST DE BEAUREGARD</localisation>
<remarque xsi:type="xsd:string" />
</multiRef>
- <multiRef id="id4" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns6:utlgen_cdr" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns6="urn:CEDSTR">
<succes xsi:type="xsd:int">1</succes>
<code xsi:type="xsd:int">0</code>
<message xsi:type="xsd:string" />
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
</ns1:cedptr_obt_cle_di_v1_HResponse>
What I can see is that PI seems to ignore the multiref tag in the SOAP response message. Does anybody knows if there is an issue with the mutiref tag in PI ?
Thanks for your help.The SOAP adapter does not support more than one body child.
If a SOAP message with several body childs arrive, then only the first body child is considered, all other body childs are ignored.
Regards
Stefan
Maybe you are looking for
-
I am trying to pair my cell phone and tablet using Messages App, but only MMS messages will come through on my tablet. I've tried pairing and unpaired, reinstalling app on my tablet, and can't figure it out. Any idea how to fix this? Thanks
-
How do I stop Firefox from opening its own homepage tab on top of my homepage?
Firefox keeps opening up its own website in my browser on top of my own home page even though I have reset the home page numerous times. Everytime I open firefox I have to reset my home page which works for a half-day or so and then ... we're back to
-
Sequence of the transaction list look different in ECC6.0 user menu
The sequence of the transaction list look different in ECC6.0 than SAP 4.6c(User Menu & SAP Menu).Is there any provision to make similar view as of SAP 4.6c in ECC6.0. Thanks Manoj
-
I am woking on small project, on which i am to convert data from SQL Server to Oracle. I am using Oracle Data Integrator. Can any body tell me the steps for it to do ? what i have done uptil now is that i have created master and work repsitories, now
-
Hello i am runnng a report in bw on an ods.now i want the job to run in the background.now at the bottom of the screen where it is written specifications for return type there are 2 options. one is store in file(workstation) other is store in file(ap