Parsing Soap Responses

Hello,
I am fairly new to CF and am trying to parse and then query a soap response from a third-party api. I have been able to get a response in xml format, but that is where I am stuck. Below the xml response I am getting an error that reads Element.LOGINRESPONSE.LOGINRESULT.XMLTEXT is undefined in LOGINXML.
I realize my code is a mess, but I am just trying out various things. Does anyone have any insight how to get at the Login Response variable in my soap response so that I can query it?
Thanks for any insight!!
<!--- WSDL --->
<cfset wsdl_url="http://somewebsite/sirewebsvc/sire.asmx?wsdl">
<cftry>
    <!--- Compose SOAP message to send to Web Service--->
    <cfsavecontent variable="soap"><?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>
                 <Login xmlns="http://www.siretechnologies.com/">
      <LicenseKey>LicenseKey</LicenseKey>
      <Username>username</Username>
      <Password>password</Password>
      <LicenseType>2</LicenseType>
      <APIKey>APIKey</APIKey>
      <SiteKey></SiteKey>
      <CryptKey></CryptKey>
      <WebOnly>false</WebOnly>
    </Login>
              </soapenv:Body>
          </soapenv:Envelope>
    </cfsavecontent>
        <!--- Invoke web service to send message--->
        <cfhttp url="#wsdl_url#" method="post" >
            <cfhttpparam type="header" name="content-type" value="text/xml">
            <cfhttpparam type="header" name="SOAPAction" value="http://www.siretechnologies.com/Login">
            <cfhttpparam type="header" name="content-length" value="#len(soap)#">
            <cfhttpparam type="header" name="charset" value="utf-8">
            <cfhttpparam type="xml" name="message" value="#trim(soap)#">
        </cfhttp>
<p><cfoutput>#xmlFormat(cfhttp.fileContent)#</cfoutput> </p>
        <cfset MyXML = XmlParse(CFHTTP.FileContent)>
        XmlSearch(MyXML, "/LoginResponse/LoginResult/")
  <cfcatch type="any">
        <cfdump var="#cfcatch#">
    </cfcatch>
</cftry>
<cfsavecontent variable="XMLFile"><?xml version="1.0"?>
<LoginResponse>
    <LoginResult>
  ???How do I get this from above, or make it a variable???
    </LoginResult>
</LoginResponse>
</cfsavecontent>
<!--- Parse the XML --->
<cfset MyXMLDoc = xmlParse(XMLFile) />
<!--- Dump the XML --->
<h2>Dump</h2>
<cfdump var="#MyXMLDoc#">
<cfset MyNodes = xmlSearch(MyXMLDoc,'/LoginResponse/LoginResult')>
<cfoutput>
    <h2>Nodes</h2>
    <cfloop from="1" to="#arraylen(MyNodes)#" index="i">
        <!--- The array contents need to parsed so you can easily get at the child nodes children and attributes. --->
        <cfset LoginXML = xmlparse(MyNodes[i]) />
        <b>SessionKey:</b> #LoginXML.LoginResponse.LoginResult.xmltext#<br>
    </cfloop>
</cfoutput>
--->

I think I figured it out. Thanks to all who helped!! If anyone is interested, this is how I retrieved the session key from my Soap response.
<!--- WSDL --->
<cfset wsdl_url="http://SOMEURL/sire.asmx?wsdl">
    <!--- Compose SOAP message to send to Web Service--->
    <cfsavecontent variable="soap"><?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>
                 <Login xmlns="http://www.siretechnologies.com/">
      <LicenseKey>LicKey</LicenseKey>
      <Username>user</Username>
      <Password>pass</Password>
      <LicenseType>2</LicenseType>
      <APIKey>API</APIKey>
      <SiteKey></SiteKey>
      <CryptKey></CryptKey>
      <WebOnly>false</WebOnly>
    </Login>
              </soapenv:Body>
          </soapenv:Envelope>
    </cfsavecontent>
        <!--- Invoke web service to send message--->
        <cfhttp url="#wsdl_url#" method="post" >
            <cfhttpparam type="header" name="content-type" value="text/xml">
            <cfhttpparam type="header" name="SOAPAction" value="http://www.siretechnologies.com/Login">
            <cfhttpparam type="header" name="content-length" value="#len(soap)#">
            <cfhttpparam type="header" name="charset" value="utf-8">
            <cfhttpparam type="xml" name="message" value="#trim(soap)#">
        </cfhttp>
        <p><cfoutput>#xmlFormat(cfhttp.fileContent)#</cfoutput> </p>
        <cfset MyXml = XmlParse(cfhttp.fileContent)>
        <cfdump var="#MyXml#">
    <cfset responseNodes = xmlSearch(MyXml,"//*[ local-name() = 'LoginResponse' ]")>
     <cfdump var="#responseNodes#">
    <cfoutput>
<cfloop from="1" to="#arraylen(responseNodes)#" index="i">
    <cfset TheXML = xmlparse(responseNodes[i])>
    <cfset SesKey = "#TheXML.LoginResponse.LoginResult.XmlText#">
    <b>SessionKey:</b> #TheXML.LoginResponse.LoginResult.XmlText#<br>
    <b>Session Key:#SesKey#
</cfloop>
</cfoutput>

Similar Messages

  • Parsing SOAP response

    Hi all,
    I'm trying to parse a response to a SOAP request and am not quite sure how to do this. I see in all the examples on the web and in the books where the information being returned is a simple type or a complex type and you can use Response.getReturnValue() to access the data.
    Either something like,
    <SOAP-ENV:Body>
    <stockquoteresponse>
    <stockprice>123.45</stockprice>
    </stockquoteresponse>
    </SOAP-ENV:Body> or
    <SOAP-ENV:Body>
    <stockquoteresponse>
    <stock>
    <tickersymbol>XYZ</tickersymbol>
    <stockprice>123.45</stockprice>
    </stock>
    </stockquoteresponse>
    </SOAP-ENV:Body> In my case however i have multiple pieces of information coming back and I am not sure how to encapsulate it in an object and if that is not possible, how to read it. I am getting something like,
    <SOAP-ENV:Body>
    <stockquoteresponse>
    <tickersymbol>XYZ</tickersymbol>
    <stockprice>123.45</stockprice>
    </stockquoteresponse>
    </SOAP-ENV:Body> Is it possible to get access to the stockquoteresponse element and deserialize that into an object ? In the examples I have seen, it doesn't seem to be possible.
    Please help.

    There are standard APIs for reading SOAP message. e.g.
    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXM.html
    If you try google you might find one approriate for you.

  • How to parse Soap response of anytype structure

    I have went through almost all url regarding this in stackoverflow but could not make it work even after following same steps,either getting property not found or arrayindex exception ,the response i am trying to parse is has below and this can contain 'n ' number of table data
    anyType{
      schema=anyType{
      element=anyType{
      complexType=anyType{
      choice=anyType{
      element=anyType{
      complexType=anyType{
      sequence=anyType{
      element=anyType{
       };element=anyType{
       };element=anyType{
       };element=anyType{
       };element=anyType{
       };diffgram=anyType{
       NewDataSet=anyType{
       Table=anyType{
       RemMessage=ExeedDiscountLimitonInvoicedatedon05/03/2015forCSHAH,
      from3-LokhandwalaShowroom;InvM_Id=77693;DocType=3;PrmR_TypeId=3;PrmR_Id=1820;
    anyone could parse this with considering multiple entries would be very useful,i have tried with one approach here Not able to parse the response getting Invalid array range: 5 to 5

    I have went through almost all url regarding this in stackoverflow but could not make it work even after following same steps,either getting property not found or arrayindex exception ,the response i am trying to parse is has below and this can contain 'n ' number of table data
    anyType{
      schema=anyType{
      element=anyType{
      complexType=anyType{
      choice=anyType{
      element=anyType{
      complexType=anyType{
      sequence=anyType{
      element=anyType{
       };element=anyType{
       };element=anyType{
       };element=anyType{
       };element=anyType{
       };diffgram=anyType{
       NewDataSet=anyType{
       Table=anyType{
       RemMessage=ExeedDiscountLimitonInvoicedatedon05/03/2015forCSHAH,
      from3-LokhandwalaShowroom;InvM_Id=77693;DocType=3;PrmR_TypeId=3;PrmR_Id=1820;
    anyone could parse this with considering multiple entries would be very useful,i have tried with one approach here Not able to parse the response getting Invalid array range: 5 to 5

  • 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.

    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.

  • Java WSDP 1.4 is not parsing SOAP Exceptions

    We used Java WSDP 1.4 toolkit to generate stubs for webservices. We used Tomcat 5.1 as the web container. When methods of the webservice are invoked which do not return SOAP exception responses, WSDP is able to properly parse the response and display the resutls correctly. But when the responses contains SOAP exceptions, WSDP always returns
    "java.rmi.RemoteException: Runtime exception; nested exception is: trailing block elements must have an id attribute".
    But other toolkits like Axis 1.1,.Net,ColdFusionMX,Glue are returning proper exceptions messages. The following is the exception message received from the other toolkits for the same method invocation.
    "Exception has been thrown by the target of an invocation. '1000:Invalid data source name 'invalid_String'"
    Apart from Java WSDP all the other toolkits that we mentioned are able to parse the exception message properly and display the same.
    Any ideas why the toolkit is behaving like this. All the versions of Java WSDP that have come till date have a similar problem. We would be happy to hear any responses for the problem the we are facing in Java WSDP 1.4. At present we have decided not to use the toolkit for any web service development.

    Am specifying the URL of the WSDL file for which we are unable to get proper SOAP Exceptions, whenever they are generated. Whenever we give valid values while invoking the methods, the response is properly parsed, but when a SOAP Exception is supposed to be generated, it generally returns the Runtime exception that we mentioned. Can you please look into it and identify the reason about why it is failing. In case you are able to run it through properly, please attach the code that would make it work properly.
    The URL is :
    http://arcweb.esri.com/services/v2/PlaceFinderSample.wsdl

  • SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPT

    Hi there,
    I am trying to publish a file from SAP as web service using XI and SOAP Adapter.
    I am using ABAP proxy to get the data into XI.
    Designing and Configuration in XI has no problems because when i use File adapter the data is trasmitted to FTP server.
    But when I used SOAP Reciever adapter I am getting following error in RWB
    Delivery of the message to the application using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Error during parsing of SOAP header.
    <b>Scenario</b>: SAP ABAP Proxy -> XI -> WebService. Asynchronous.
    <b>SOAP</b> Receiver adaptor.
    <b>Target URL</b> http://<host>:<port number >/sap/xi/engine?type=entry&version=3.0&Sender.Service=SAPDC2653&Interface=urn:bzttest:00:hsa:test%5EOB_MI_BZT_TEST&QualityOfService=ExactlyOnce
    Do not use SOAP Envelop is checked.
    <b>SOAP Action</b> http://sap.com/xi/WebService/soap1.1
    What i am missing here? How should I solve this problem?
    Any help is appreciated,
    Thx,
    Yogi

    Say there's a bapi/rfc that you want to call on an R/3 backend (e.g. 4.6c).  On it's own, the R/3 system cannot expose the rfc/bapi as a web service, but XI can.  So in this case, the scenario would be:
    WS client -> XI -> R/3
    When XI "exposes" a web service, it is exposing a service for a receiving system (in the above example, the R/3 system).  XI itself does not provide or contain the service implementation.  When XI exposes a web service, it is always done via the <b>sender</b> soap adapter (i.e. if soap adapter is used).   Receiver soap adapter is used to call or consume an actual web service from an external application.
    Regards,
    Jin

  • Mapping of Web Service SOAP response document

    Hi all!
    The XI mapping expects a namespace qualified root element of my web service's response SOAP document. Unfortunately my web service (written with AXIS) only provides the "xmlns"-declaration but no namespace-prefix for this element as expected by XI. For this reason the mapping is not working. I am quite desperate and could need some help how to fix that.
    All child elements are expected to be non-qualified, only the root element is expected to be qualified. I got this information from the test environment of the message mapping when generating a test XML instance.
    Denis

    I just had the same problem and solved it like this: I modified the WSDL slightly by removing the prefix from the reference to the element of the response message, as well as the "targetNamespace" in the xsd:schema segment of the WSDL. Like this, SAP is able to parse the response.
    Philippe

  • Soap response with envelope

    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 this

    Hi,
    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

  • Idoc to soap scenario - soap response error

    hi
    i am using pi 731 single stack.
    the scenario is idoc to soap. the message mapping is working fine and output is generated successfully.
    the message is failing in mesage monitor and communication channel monitor. error is -
    Exception caught by adapter framework: SOAP: Response message contains an errorXIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: VEN-OMI-1007:
    This scenario is async scenario. How to soap remove this response message error.
    rgds

    Dear,
    IDoc to Soap scenario we have to import wsdl at receiver end and map the field from the mapping document but some times receiver end some changes may happen. if it is correct only your mapping we have to conclude from the below points.
    1. Check the mapping in Message Mapping and Operation Mapping Test and conclude.
    2. you should check url from receiver that is correct or wrong.
    3. ask the wsdl from receiver end.
    the given ED and receiver side application is same this type of error will not come.
    Please check at receiver application or else what ever new fields are added in reciver may be miss mach of ED.
    Regards,
    Kiran Polani

  • SOAP: response message contains an error

    Hi,
    I send a message by PI to a service and I get the following message:
    SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: No such operation SETCOMPANYFIELDVALUERequest
    The scenario that I use is a RFC --> PI --> SOAP. The WSDL looks like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="urn:DefaultNamespace" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:DefaultNamespace" xmlns:intf="urn:DefaultNamespace" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsdl:message name="SETCOMPANYFIELDVALUERequest">
      <wsdl:part name="COMPANYNAME1" type="xsd:string"/>
      <wsdl:part name="COMPANYNAME2" type="xsd:string"/>
    </wsdl:message>
    <wsdl:message name="SETCOMPANYFIELDVALUEResponse">
      <wsdl:part name="SETCOMPANYFIELDVALUEReturn" type="xsd:anyType"/>
    </wsdl:message>
    <wsdl:portType name="AppLSDataSync">
      <wsdl:operation name="SETCOMPANYFIELDVALUE" parameterOrder="COMPANYNAME1 COMPANYNAME2">
       <wsdl:input message="intf:SETCOMPANYFIELDVALUERequest" name="SETCOMPANYFIELDVALUERequest"/>
       <wsdl:output message="intf:SETCOMPANYFIELDVALUEResponse" name="SETCOMPANYFIELDVALUEResponse"/>
      </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="DominoSoapBinding" type="intf:AppLSDataSync">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <wsdl:operation name="SETCOMPANYFIELDVALUE">
       <wsdlsoap:operation soapAction="SETCOMPANYFIELDVALUE"/>
       <wsdl:input name="SETCOMPANYFIELDVALUERequest">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:DefaultNamespace" use="encoded"/>
       </wsdl:input>
       <wsdl:output name="SETCOMPANYFIELDVALUEResponse">
        <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="urn:DefaultNamespace" use="encoded"/>
       </wsdl:output>
      </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="AppLSDataSyncService">
      <wsdl:port binding="intf:DominoSoapBinding" name="Domino">
       <wsdlsoap:address location="http://localhost"/>
      </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
    When I send the same message using the WebServiceNavigator everything is working fine.
    The WSDL that I have imported into PI is the same that is available that I use calling by the WSNavigator.
    Anyone an Idea?
    Thanks Ron

    HI
    WSDL is having some problem
    When you imported this wsdl how many messages does it show. Check weather it is having SETCOMPANYFIELDVALUE request and response. you can check the messages carried in a wsdl using the messages tab in external definition.
    Thanks

  • Error when trying to read the SOAP Response

    Hai,
    iam trying to access the web service of DUBAI international Airport
    GetFlightSchedulebyDateRange at http://dca.gov.ae/WebServices/Flights
    This is my program
    package MyClient3;
    import java.io.FileOutputStream;
    import java.net.URL;
    import java.util.Iterator;
    import javax.xml.soap.MessageFactory;
    import javax.xml.soap.MimeHeaders;
    import javax.xml.soap.Name;
    import javax.xml.soap.SOAPBody;
    import javax.xml.soap.SOAPBodyElement;
    import javax.xml.soap.SOAPConnection;
    import javax.xml.soap.SOAPConnectionFactory;
    import javax.xml.soap.SOAPElement;
    import javax.xml.soap.SOAPEnvelope;
    import javax.xml.soap.SOAPFactory;
    import javax.xml.soap.SOAPFault;
    import javax.xml.soap.SOAPHeader;
    import javax.xml.soap.SOAPMessage;
    import javax.xml.soap.SOAPPart;
    public class Client3 {
    public static void main(String arg[]){
    try{
    MessageFactory factory = MessageFactory.newInstance();
    SOAPMessage message = factory.createMessage();
    SOAPPart soapPart = message.getSOAPPart();
    SOAPEnvelope envelope = soapPart.getEnvelope();
    SOAPHeader header = envelope.getHeader();
    SOAPBody body = envelope.getBody();
    // header.detachNode();
    SOAPFactory soapFactory = SOAPFactory.newInstance();
    Name bodyName = soapFactory.createName("GetFlightSchedulebyDateRange",null,"http://dca.gov.ae/WebServices/Flights");
    SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
    Name name = soapFactory.createName("Todate");
    SOAPElement symbol = bodyElement.addChildElement(name);
    //symbol.addTextNode("2007-05-25T00:00:00.0000000+04:00");
    symbol.addTextNode("2007-05-27");
    name = soapFactory.createName("Fromdate");
    symbol = bodyElement.addChildElement(name);
    //symbol.addTextNode("2007-05-25T00:00:00.0000000+04:00");
    symbol.addTextNode("2007-05-27");
    MimeHeaders hd = message.getMimeHeaders();
    hd.addHeader("SOAPAction", "http://dca.gov.ae/WebServices/Flights/GetFlightSchedulebyDateRange");
    SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
    SOAPConnection connection = soapConnectionFactory.createConnection();
    message.writeTo(System.out);
    System.out.println();
    System.out.println(soapPart.toString());
    String endpoint = "http://dubaiairport.com/dcaflightinfo/fis/flights.asmx?WSDL";
    URL url = new URL(endpoint);
    SOAPMessage response = connection.call(message, url);
    response.writeTo(System.out);
    SOAPPart part = response.getSOAPPart();
    SOAPEnvelope env = part.getEnvelope();
    connection.close();
    System.out.println("\n\nIterating through the response object to get the values:\n\n");
    // SOAPBody se = response.getSOAPBody();
    }catch(Exception e){System.out.println("+++++++++++++++++++++++++"+e);}
    i am getting the error
    ERROR: 'Character reference "&#x1B" is an invalid XML character.
    in the statement
    SOAPEnvelope env = part.getEnvelope();
    can some help me to solve this problem, iam using JAX-WS 2.0, and netbeans

    I got the solution, there was a Invalid char in SOAP response message, i stored the SOAP res msg to a file, parsed that file to remove the invalid char , ans used the soap msg from the file,
    it worked perfectly fo me

  • Error at SOAP response channel

    Dear All,
    I have created a synchronous PROXY to SOAP scenario. But I am getting the following error in the receiver SOAP Adapter.
    Message processing failed. Cause:
    com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP:
    response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION -
    soap fault: System.Web.Services.Protocols.SoapException: Server was unable to
    process request. ---> System.NullReferenceException: Object reference not set
    to an instance of an object.
    --- End of inner exception stack trace ---
    Please suggest what may be the reason for it.
    Thanks and Regards,
    Rana Brata De
    SAP PI Consultant

    Hi,
    We have faced similar problem in production some time back .
    At target system end web service validates the payload below inserting into back end system (d/b).If the validation fails then it throws the error to PI system .
    For us the backend system notified that there end front end service validation failed due to data issue and thrown exception to PI.
    Share the payload to target system folks and ask them to check ,they will have test suite to test it from there end . If not share the time at which you received error,they will check there logs and update you on the cause .
    Regards
    Venkat

  • XML in SOAP response

    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 &lt;) 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>

  • SOAP Response conatins no quots, no opening or closing tags.

    Hello All,
    I have developed WebService and I have deployed it on a server, and I have developed client that speak with the WebService via the JDeveloper generated EmbeddedIntegrationWebServiceStub and everything goes greatly when the WebService and the Client are running locally, also it works greatly when the WebService are hosted on server and the client run locally but after I deployed the client to another testing server I found strange behavioure that the returned soap repsonse to the client contans no &lt; or &gt; or "" so I make some dummy solution to regenerate the missing &lt;, &gt;, or "" but the server (hosting the client) keeps giving me the following exception
    bq.      08/10/14 00:02:18 org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486) \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.store.Locale.parse(Locale.java:712) \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:696) \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:683) \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:208) \\     08/10/14 00:02:18 at ae.dxbpolice.eps.xml.xmlBeans.ProcVersionsDocument$Factory.parse(Unknown Source) \\     08/10/14 00:02:18 at ae.dxbpolice.eps.tld.tag.FormCustomTag.doStartTag(FormCustomTag.java:158) \\     08/10/14 00:02:18 at eps_integration._jspService(_eps__integration.java:65) \\     08/10/14 00:02:18 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) \\     08/10/14 00:02:18 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121) \\     08/10/14 00:02:18 at com.evermind.server.http.GetParametersRequestDispatcher.newInclude(GetParametersRequestDispatcher.java:80) \\     08/10/14 00:02:18 at com.evermind.server.http.GetParametersRequestDispatcher.include(GetParametersRequestDispatcher.java:34) \\     08/10/14 00:02:18 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267) \\     08/10/14 00:02:18 at e_services._jspService(_e__services.java:333) \\     08/10/14 00:02:18 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) \\     08/10/14 00:02:18 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) \\     08/10/14 00:02:18 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) \\     08/10/14 00:02:18 at ae.gov.dphq.internet.util.InternetFilter.doFilter(InternetFilter.java:111) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322) \\     08/10/14 00:02:18 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790) \\     08/10/14 00:02:18 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208) \\     08/10/14 00:02:18 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125) \\     08/10/14 00:02:18 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186) \\     08/10/14 00:02:18 at java.lang.Thread.run(Thread.java:534) \\     08/10/14 00:02:18 Caused by: org.xml.sax.SAXParseException: Unexpected element: CDATA \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038) \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723) \\     08/10/14 00:02:18 at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454) \\     08/10/14 00:02:18 ... 32 more \\     08/10/14 00:02:18 javax.servlet.jsp.JspTagException: SimpleTag: error: Unexpected element: CDATA \\     08/10/14 00:02:18 at ae.dxbpolice.eps.tld.tag.FormCustomTag.doStartTag(FormCustomTag.java:277) \\     08/10/14 00:02:18 at eps_integration._jspService(_eps__integration.java:65) \\     08/10/14 00:02:18 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) \\     08/10/14 00:02:18 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.include(ServletRequestDispatcher.java:121) \\     08/10/14 00:02:18 at com.evermind.server.http.GetParametersRequestDispatcher.newInclude(GetParametersRequestDispatcher.java:80) \\     08/10/14 00:02:18 at com.evermind.server.http.GetParametersRequestDispatcher.include(GetParametersRequestDispatcher.java:34) \\     08/10/14 00:02:18 at com.evermind.server.http.EvermindPageContext.include(EvermindPageContext.java:267) \\     08/10/14 00:02:18 at e_services._jspService(_e__services.java:333) \\     08/10/14 00:02:18 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:347) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509) \\     08/10/14 00:02:18 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413) \\     08/10/14 00:02:18 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) \\     08/10/14 00:02:18 at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) \\     08/10/14 00:02:18 at ae.gov.dphq.internet.util.InternetFilter.doFilter(InternetFilter.java:111) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:649) \\     08/10/14 00:02:18 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322) \\     08/10/14 00:02:18 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790) \\     08/10/14 00:02:18 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208) \\     08/10/14 00:02:18 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125) \\     08/10/14 00:02:18 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186) \\     08/10/14 00:02:18 at java.lang.Thread.run(Thread.java:534)
    and this is the XML document that generate this problem
    bq.      &lt;procVersions xmlns="http://www.xmlBeans.xml.eps.dxbpolice.ae"&gt; \\     &lt;procVersion id="2" beneficiaryType="EXTERNAL_PERSON" importanceLevel="NORMAL" isIncludeHierarchy="false" isNotifiable="false" isRemote="false" nameAR="&Ccedil;&Igrave;&Ntilde;&Ccedil;&Aacute; &aelig;&ccedil;&Ccedil;&ecirc;&Eacute; &Ccedil;&auml;&Icirc;&Iuml;&aring;&Eacute;" nameEN="Termination Procedure" status="ACTIVE" versionNo="V1"/&gt; \\     &lt;procVersion id="21" beneficiaryType="EXTERNAL_COMPANY" importanceLevel="NORMAL" isIncludeHierarchy="false" isNotifiable="false" isRemote="false" nameAR="&Ccedil;&Igrave;&Ntilde;&Ccedil;&Aacute; &times;&auml;&Egrave; &Atilde;&Igrave;&Ccedil;&Ograve;&Eacute;" nameEN="Vacation Request Procedure" status="ACTIVE" versionNo="V2"/&gt; \\     &lt;/procVersions&gt;
    so are there any suggestion about why the resposnse I got before my processing contains no &lt; or &gt; or " on the server however it comes gratly locally is there any library I should make sure that it doesn't exist on the server.
    this is how the xml returned looks before manual adjustment
    bq. procVersions xmlns=http://www.xmlBeans.xml.eps.dxbpolice.ae \\ procVersion id=2 beneficiaryType=EXTERNAL_PERSON importanceLevel=NORMAL isIncludeHierarchy=false isNotifiable=false isRemote=false nameAR=&Ccedil;&Igrave;&Ntilde;&Ccedil;&Aacute; &aelig;&ccedil;&Ccedil;&ecirc;&Eacute; &Ccedil;&auml;&Icirc;&Iuml;&aring;&Eacute; nameEN=Termination Procedure status=ACTIVE versionNo=V1/ \\ procVersion id=21 beneficiaryType=EXTERNAL_COMPANY importanceLevel=NORMAL isIncludeHierarchy=false isNotifiable=false isRemote=false nameAR=&Ccedil;&Igrave;&Ntilde;&Ccedil;&Aacute; &times;&auml;&Egrave; &Atilde;&Igrave;&Ccedil;&Ograve;&Eacute; nameEN=Vacation Request Procedure status=ACTIVE versionNo=V2/ \\ /procVersions
    and why it keeps giving me the same problem even after I have corrected the returned soap response manually
    Thanks in advance
    Edited by: Ali Abdel-Aziz on Oct 13, 2008 9:22 PM

    ok, now my work arround works greatly as I was missing to pass the correct variable to the parser method and was passing the same old variable ;).
    but I still wanna know what can be the reason for filtering the returned soap response and remove &lt;, &gt;, " from it.
    Are there any Application Server configuration that can be the reason for this behavioure ?
    thanks.
    Edited by: Ali Abdel-Aziz on Oct 14, 2008 2:39 PM

  • Wsdl - soap response...

    I am working on java ,using Eclipse wit wtp and Apache Axis. The soap request is sent, an xml file is parsed and I want to generate soap responses from the xml file.
    Now i can send a soap request, parse the xml, but the response am getting is not of soap format, its jus a simple data...
    For eg.. if the request is add no.s ( 5+ 7) i get the sum(12) or if i request for author of a book from i just get author's name.. 
    Instead i want it as a soap response... some thing like this for requesting the stock price...
    <?xml version="1.0"?>
    <soap:Envelope
    xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
    soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
      <soap:Body xmlns:m="http://www.example.org/stock">
        <m:GetStockPriceResponse>
          <m:Price>34.5</m:Price>
        </m:GetStockPriceResponse>
      </soap:Body>
    </soap:Envelope>
    How do i get the sopa response using the wsdl file that gets generated... ????
    Or is there another way of generating the soap responses.. ?
    Plz help me out...

    Hi,
    All that you want to do is trying to call a web service and get the response from it, you can use the WSDLs from any weather or lets say google. From XI you can call it and you would get response in SOAP format.
    If you want to create a web service, create a SOAP to RFC scenario in XI where RFC returns you some thing that you wanted in sync fashion. Now use the WSDL genrated from this scenario and import in XI for another scenario.. where it could be a HTTP to SOAP. Now you would get the response of RFC in SOAP format it self..
    VJ

Maybe you are looking for