Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Error on XSLT transforming a SOAP response

Former Member
0 Kudos

Hello,

I am getting error ABAP XML formatting error in XML node of type "element", name: "abap" using my XSLT program.

Here is the XML response (SOURCE) as string.

b60##<?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:execResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://webservice.hostname.com/"><execReturn xsi:type="xsd:string"><?xml version="1.0" encoding="Shift_JIS" ?><Report><Header><system>ABCWEB</system><dataType>ABCDEFGHIJ</dataType><sendType>response</sendType></Header><Body><SequenceNo>1234567890</SequenceNo><InquiryFactory>ABC</InquiryFactory><ProcessingID></ProcessingID><ProcessingDate>1234567890</ProcessingDate><KeyNo>ABCDEFGHIJ</KeyNo><ProcessingClassify>S</ProcessingClassify><Product>ABCDEFGHIJ</Product><ResponseClassify>0</ResponseClassify><OrderInformation-List><OrderInquiry><TransferNo>1234567890</TransferNo><TransferLineNo>000010</TransferLineNo><CustomerOrderNo>ABCDEFGHIJ</CustomerOrderNo><CustomerOrderLineNo> </CustomerOrderLineNo><ShipInstructionNo>1234567890</ShipInstructionNo><DropUnitPrice>1234567890</DropUnitPrice><Qty>200</Qty><Amount>6000</Amount><WBSNo> </WBSNo><SpecPartNo>ABCDEFGHIJ</SpecPartNo></OrderInquiry></OrderInformation-List><SalesOrderPartNo>ABCDEFGHIJ</SalesOrderPartNo><CatalogPartNo></CatalogPartNo><AgentPartNo>1234567890</AgentPartNo><CustomerPartNo></CustomerPartNo><R3CompanyCD>1000</R3CompanyCD><OrderPlacingCompanyCD>R110011</OrderPlacingCompanyCD><ShipToCD>1234567890</ShipToCD><ShipToCompanyName>SINGAPORE</ShipToCompanyName><ShipToAddress1>ABCDEFGHIJ</ShipToAddress1><ShipToAddress2>ABCDEFGHIJ</ShipToAddress2><ShipToAddress3>SINGSAPORE</ShipToAddress3><ShipToAddress4></ShipToAddress4><ULPort>ABCDEFGHIJ</ULPort><DropCurrency>EUR</DropCurrency><DeliveryAirport>SINGAPORE</DeliveryAirport><DropMethod></DropMethod><SCMCustomer>EA07000442</SCMCustomer><RealShipToCd></RealShipToCd><SOCurrency></SOCurrency><SOPayterm></SOPayterm><LogisticCategory>0</LogisticCategory><SOOrderNo></SOOrderNo><MaterialKeyA1>1234567890</MaterialKeyA1></Body></Report></execReturn></ns1:execResponse></soapenv:Body></soapenv:Envelope>##0####

The above is the result after adding the following modifications in ABAP.

REPLACE ALL OCCURRENCES OF

'&lt;' IN wf_string1 WITH '<' .

REPLACE ALL OCCURRENCES OF

'&gt;' IN wf_string1 WITH '>' .

REPLACE ALL OCCURRENCES OF

'&quot;' IN wf_string1 WITH '"'

I would like to display the result starting from <BODY> as table as shown below.

SequenceNo 1234567890

InquiryFactory ABC

ProcessingID

ProcessingDate 1234567890

and so on.

I am using the the same ABAP/XSLT program following example /people/durairaj.athavanraja/blog/2004/09/20/consuming-web-service-from-abap

Please let me know what I did wrong.

Tony

3 REPLIES 3

Former Member
0 Kudos

The transformation itself could be used to convert XML to ABAP.

Try something like this.

CALL TRANSFORMATION your_transformation_name
      SOURCE XML l_xml_string
      RESULT     protocol_version = l_prot_version
                 check_id         = l_check_id
                 message_id       = l_msg_id
                 message_text     = l_msg_text
                 t_arguments      = lt_arguments
                 creator          = l_creator.

Edited by: Sandeep S on Jun 29, 2011 6:22 PM

0 Kudos

I have no idea why this is showing like this, but please bear with me. I tried every way I can to make my reply readable but the text editor is keeping on doing this. So here it goes.

Hi Sandeep,

I tried to debug the CALL transformation. I am getting CX_XSLT_FORMAT_ERROR and when I run the whole program this is the error message "ABAP XML formatting error in XML node of type "element", name: "abap"

Here is my XLST program for the response above.

 &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt;
  &lt;xsl:strip-space elements="*"/&gt;
  &lt;xsl:output indent="yes"/&gt;
  &lt;xsl:template match="NewDataSet"&gt;
        &lt;OUTTAB&gt;
          &lt;xsl:for-each select="Table"&gt;
            &lt;OUTTAB1&gt;
              &lt;report&gt;
                &lt;header&gt;
                  &lt;system&gt;
                    &lt;xsl:value-of select="system"/&gt;
                  &lt;/system&gt;
                  &lt;dataType&gt;
                    &lt;xsl:value-of select="dataType"/&gt;
                  &lt;/dataType&gt;
                  &lt;sendType&gt;
                    &lt;xsl:value-of select="sendType"/&gt;
                  &lt;/sendType&gt;
                &lt;/header&gt;
                &lt;body&gt;
                  &lt;SequenceNo&gt;
                    &lt;xsl:value-of select="SequenceNo"/&gt;
                  &lt;/SequenceNo&gt;
                  &lt;InquiryFactory&gt;
                    &lt;xsl:value-of select="InquiryFactory"/&gt;
                  &lt;/InquiryFactory&gt;
                  &lt;ProcessingID&gt;
                    &lt;xsl:value-of select="ProcessingID"/&gt;
                  &lt;/ProcessingID&gt;
                  &lt;ProcessingDate&gt;
                    &lt;xsl:value-of select="ProcessingDate"/&gt;
                  &lt;/ProcessingDate&gt;
                  &lt;KeyNo&gt;
                    &lt;xsl:value-of select="KeyNo"/&gt;
                  &lt;/KeyNo&gt;
                  &lt;ProcessingClassify&gt;
                    &lt;xsl:value-of select="ProcessingClassify"/&gt;
                  &lt;/ProcessingClassify&gt;
                  &lt;Product&gt;
                    &lt;xsl:value-of select="Product"/&gt;
                  &lt;/Product&gt;
                  &lt;ResponseClassify&gt;
                    &lt;xsl:value-of select="ResponseClassify"/&gt;
                  &lt;/ResponseClassify&gt;
                  &lt;OrderInformation-List&gt;
                    &lt;OrderInquiry&gt;
                      &lt;TransferNo&gt;
                        &lt;xsl:value-of select="TransferNo"/&gt;
                      &lt;/TransferNo&gt;
                      &lt;TransferLineNo&gt;
                        &lt;xsl:value-of select="TransferLineNo"/&gt;
                      &lt;/TransferLineNo&gt;
                      &lt;CustomerOrderNo&gt;
                        &lt;xsl:value-of select="CustomerOrderNo"/&gt;
                      &lt;/CustomerOrderNo&gt;
                      &lt;CustomerOrderLineNo&gt;
                        &lt;xsl:value-of select="CustomerOrderLineNo"/&gt;
                      &lt;/CustomerOrderLineNo&gt;
                      &lt;ShipInstructionNo&gt;
                        &lt;xsl:value-of select="ShipInstructionNo"/&gt;
                      &lt;/ShipInstructionNo&gt;
                      &lt;DropUnitPrice&gt;
                        &lt;xsl:value-of select="DropUnitPrice"/&gt;
                      &lt;/DropUnitPrice&gt;
                      &lt;Qty&gt;
                        &lt;xsl:value-of select="Qty"/&gt;
                      &lt;/Qty&gt;
                      &lt;Amount&gt;
                        &lt;xsl:value-of select="Amount"/&gt;
                      &lt;/Amount&gt;
                      &lt;WBSNo&gt;
                        &lt;xsl:value-of select="WBSNo"/&gt;
                      &lt;/WBSNo&gt;
                      &lt;SpecPartNo&gt;
                        &lt;xsl:value-of select="SpecPartNo"/&gt;
                      &lt;/SpecPartNo&gt;
                    &lt;/OrderInquiry&gt;
                  &lt;/OrderInformation-List&gt;
                  &lt;SalesOrderPartNo&gt;
                    &lt;xsl:value-of select="SalesOrderPartNo"/&gt;
                  &lt;/SalesOrderPartNo&gt;
                  &lt;CatalogPartNo&gt;
                    &lt;xsl:value-of select="CatalogPartNo"/&gt;
                  &lt;/CatalogPartNo&gt;
                  &lt;AgentPartNo&gt;
                    &lt;xsl:value-of select="AgentPartNo"/&gt;
                  &lt;/AgentPartNo&gt;
                  &lt;CustomerPartNo&gt;
                    &lt;xsl:value-of select="CustomerPartNo"/&gt;
                  &lt;/CustomerPartNo&gt;
                  &lt;R3CompanyCD&gt;
                    &lt;xsl:value-of select="R3CompanyCD"/&gt;
                  &lt;/R3CompanyCD&gt;
                  &lt;OrderPlacingCompanyCD&gt;
                    &lt;xsl:value-of select="OrderPlacingCompanyCD"/&gt;
                  &lt;/OrderPlacingCompanyCD&gt;
                  &lt;ShipToCD&gt;
                    &lt;xsl:value-of select="ShipToCD"/&gt;
                  &lt;/ShipToCD&gt;
                  &lt;ShipToCompanyName&gt;
                    &lt;xsl:value-of select="ShipToCompanyName"/&gt;
                  &lt;/ShipToCompanyName&gt;
                  &lt;ShipToAddress1&gt;
                    &lt;xsl:value-of select="ShipToAddress1"/&gt;
                  &lt;/ShipToAddress1&gt;
                  &lt;ShipToAddress2&gt;
                    &lt;xsl:value-of select="ShipToAddress2"/&gt;
                  &lt;/ShipToAddress2&gt;
                  &lt;ShipToAddress3&gt;
                    &lt;xsl:value-of select="ShipToAddress3"/&gt;
                  &lt;/ShipToAddress3&gt;
                  &lt;ShipToAddress4&gt;
                    &lt;xsl:value-of select="ShipToAddress4"/&gt;
                  &lt;/ShipToAddress4&gt;
                  &lt;ULPort&gt;
                    &lt;xsl:value-of select="ULPort"/&gt;
                  &lt;/ULPort&gt;
                  &lt;DropCurrency&gt;
                    &lt;xsl:value-of select="DropCurrency"/&gt;
                  &lt;/DropCurrency&gt;
                  &lt;DeliveryAirport&gt;
                    &lt;xsl:value-of select="DeliveryAirport"/&gt;
                  &lt;/DeliveryAirport&gt;
                  &lt;DropMethod&gt;
                    &lt;xsl:value-of select="DropMethod"/&gt;
                  &lt;/DropMethod&gt;
                  &lt;SCMCustomer&gt;
                    &lt;xsl:value-of select="SCMCustomer"/&gt;
                  &lt;/SCMCustomer&gt;
                  &lt;RealShipToCd&gt;
                    &lt;xsl:value-of select="RealShipToCd"/&gt;
                  &lt;/RealShipToCd&gt;
                  &lt;SOCurrency&gt;
                    &lt;xsl:value-of select="SOCurrency"/&gt;
                  &lt;/SOCurrency&gt;
                  &lt;SOPayterm&gt;
                    &lt;xsl:value-of select="SOPayterm"/&gt;
                  &lt;/SOPayterm&gt;
                  &lt;LogisticCategory&gt;
                    &lt;xsl:value-of select="LogisticCategory"/&gt;
                  &lt;/LogisticCategory&gt;
                  &lt;SOOrderNo&gt;
                    &lt;xsl:value-of select="SOOrderNo"/&gt;
                  &lt;/SOOrderNo&gt;
                  &lt;MaterialKeyA1&gt;
                    &lt;xsl:value-of select="MaterialKeyA1"/&gt;
                  &lt;/MaterialKeyA1&gt;
                &lt;/body&gt;
              &lt;/report&gt;
            &lt;/OUTTAB1&gt;
          &lt;/xsl:for-each&gt;
        &lt;/OUTTAB&gt;
  &lt;/xsl:template&gt;
&lt;/xsl:stylesheet&gt; 

Also I noticed that the actual response has two version header. Would it matter? Do I need to crop this out from the actual XML response before transformation. My OUTTAB is still empty.

 *&lt;?xml version="1.0" encoding="utf-8"?&gt;*&lt;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"&gt;&lt;soapenv:Body&gt;&lt;ns1:execResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://webservice.hostname.com/"&gt;&lt;execReturn xsi:type="xsd:string"&gt;*&lt;?xml version="1.0" encoding="Shift_JIS" ?&gt;*&lt;Report&gt;&lt;Header&gt;&lt;system&gt; 

Please advise. Thank you.

Tony

0 Kudos

Just realize that the output of my XSLT when I tst it with "output to string" is another XML. I tried Simple Transformation but getting internal error. Somehow our R3 4.7 does not have Simple Transformation as checked from SE80 (viewing TAG LIBRARY) is there a way to convert XSLT to Simple Transformation?