Array treatment in XSLT

Guys,
I have a XML like:
<root>
<people>
<name>John</name>
<name>Peter</name>
</people>
<ID>
<personalID>001</personalID>
<personalID>002</personalID>
</ID>
</root>
I need to order these people's names and IDs in person tags in target XML, like:
<people>
<person>
<name>John</name>
<personalID>001</personalID>
</person>
<person>
<name>Peter</name>
<personalID>002</personalID>
</person>
</people>
It's easy to do this in Message Mapping. However, I need to do this with XSLT (in order to keep subnodes' indentation, since Message Mappings will remove any indentation on the source message).
I've thought a while about it but I didn't find any way of doing it with XSLT. I mean, I need to make a for-each loop and to copy-of the equivalent nodes (name and person) for that loop index. I tried to use position() but with no success. How can I get the node that corresponds to some index from a subset?
Thanks in advance,
Henrique.

Well,
it will be the same since the expression "$index" does not denote a proper condition (it's always true).
I have implemented a xslt with one loop only but with the proper condition expression. It's like this:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<xsl:variable name="idRoot" select="root/ID/personalID"/>
<people>
<xsl:for-each select="root/people/name">
<person>
<xsl:copy-of select="."/>
<xsl:variable name="index" select="position()"/>
<xsl:copy-of select="$idRoot[position() = $index]"/>
</person>
</xsl:for-each>
</people>
</xsl:template>
</xsl:stylesheet>
Regards,
Henrique.

Similar Messages

  • Using XSLT "adapter" for invoking a WS with SOAP-ENC array type param.

    Hello,
    I had to write a BPEL process that calls inside it a web service which has as an input an array parameter and as an output, also an array. I already know that BPEL has limitations regarding using the SOAP-ENC Array type. I tried to rewrite the web service in order to use a literal encoding of the array parameters (using "maxOccurs" attribute), but unfortunately, the OC4J container 9.0.4 that I have to use doesn't allow this. It only allows the SOAP-ENC types for array types.
    I started to write, inside the BPEL process, some "adapters" XSLT transformations before and after the invoking of the web service that uses SOAP-ENC array. The XSLT transformation before the web service invoking will translate the input array parameter defined with no SOAP encoding types (based on "maxOccurs" attribute) into a SOAP-ENC type, as it is expected by the web service. The XSLT transformation after the web service invoking will translate the returned array SOAP-ENC type into a data type defined with no SOAP encoding types (based on "maxOccurs" attribute).
    The approach is pretty hairy, from the XSLT point of view and it introduces a supplementary delay due to the XSLT processing needed, but it works. The only think is that when I build the service, I obtain the following error message:
    [bpelc] [Error] GCDBWebservice?WSDL:30:42: src-resolve.4.2: Error resolving component 'SOAP-ENC:Array'. It was detected that 'SOAP-ENC:Array' is in namespace 'http://schemas.xmlsoap.org/soap/encoding/', but components from this namespace are not referenceable from schema ...
    But in spite of this, the process is built and deployed successfully and I was able to run it from the BPEL console.
    Do you think that this approach could hide some other future problems that I can't see in this moment?
    Thanks,
    Marinel

    Please help me for this.
    I am new to Webservices and SOAP.
    I am facing problem when i am calling a "add" method in the .net webservices with the following code but it gives correct result when i'm calling the "HelloWorld" method present in the webservice.
    I think it will happening because, when i'm going to pass any parameter to the "add method , it does not process it.It will return me 0.
    Please help me in this.
    The code is:
    import java.io.*;
    import java.util.*;
    import java.net.*;
    import org.w3c.dom.*;
    import org.apache.soap.util.xml.*;
    import org.apache.soap.*;
    import org.apache.soap.encoding.*;
    import org.apache.soap.encoding.soapenc.*;
    import org.apache.soap.encoding.literalxml.*;
    import org.apache.soap.rpc.*;
    import org.apache.soap.transport.http.SOAPHTTPConnection;
    import org.apache.soap.transport.*;
    import org.apache.soap.messaging.*;
    import org.apache.xerces.parsers.*;
    import org.apache.xerces.dom.DocumentImpl;
    public class testClient {
    public static void main(String[] args) throws Exception {
    URL url = new URL ("http://Eurotele-it3/webService1/Service1.asmx");
    //Map the Types.
    SOAPMappingRegistry smr = new SOAPMappingRegistry ();
    StringDeserializer sd = new StringDeserializer ();
    smr.mapTypes(Constants.NS_URI_SOAP_ENC,new QName("http://Eurotele-it3/WebService1/Service1","addResult"),Integer.class,null,sd);
    // create the transport and set parameters
    SOAPHTTPConnection st = new SOAPHTTPConnection();
    // build the call.
    Call call = new Call();
    call.setSOAPTransport(st);
    call.setSOAPMappingRegistry(smr);
    call.setTargetObjectURI ("http://Eurotele-it3/WebService1/Service1/add");
    call.setMethodName("add");
    //call.setEncodingStyleURI("http://schemas.xmlsoap.org/soap/encoding/");
    call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
    Vector params = new Vector();
    params.addElement(new Parameter("x",Integer.class,"10",null));
    params.addElement(new Parameter("y",Integer.class,"20",null));
    call.setParams(params);
    Response resp = null;
    try {
    resp = call.invoke (url,"http://Eurotele-it3/WebService1/Service1/add");
    catch (SOAPException e) {
    System.err.println("Caught SOAPException (" + e.getFaultCode () + "): " +e.getMessage ());
    return;
    // check response
    if (resp != null && !resp.generatedFault()) {
    Parameter ret =resp.getReturnValue();
    Object value =ret.getValue();
    System.out.println ("Answer--> " +value );
    else {
    Fault fault = resp.getFault ();
    System.err.println ("Generated fault: ");
    System.out.println (" Fault Code = " + fault.getFaultCode());
    System.out.println (" Fault String = " + fault.getFaultString());
    This is the complete WSDL format:
    <?xml version="1.0" encoding="utf-8" ?>
    - <wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://Eurotele-it3/WebService1/Service1" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://Eurotele-it3/WebService1/Service1" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
    - <wsdl:types>
    - <s:schema elementFormDefault="qualified" targetNamespace="http://Eurotele-it3/WebService1/Service1">
    - <s:element name="HelloWorld">
    <s:complexType />
    </s:element>
    - <s:element name="HelloWorldResponse">
    - <s:complexType>
    - <s:sequence>
    <s:element minOccurs="1" maxOccurs="1" name="HelloWorldResult" type="s:int" />
    </s:sequence>
    </s:complexType>
    </s:element>
    - <s:element name="add">
    - <s:complexType>
    - <s:sequence>
    <s:element minOccurs="1" maxOccurs="1" name="x" type="s:int" />
    <s:element minOccurs="1" maxOccurs="1" name="y" type="s:int" />
    </s:sequence>
    </s:complexType>
    </s:element>
    - <s:element name="addResponse">
    - <s:complexType>
    - <s:sequence>
    <s:element minOccurs="1" maxOccurs="1" name="addResult" type="s:int" />
    </s:sequence>
    </s:complexType>
    </s:element>
    </s:schema>
    </wsdl:types>
    - <wsdl:message name="HelloWorldSoapIn">
    <wsdl:part name="parameters" element="tns:HelloWorld" />
    </wsdl:message>
    - <wsdl:message name="HelloWorldSoapOut">
    <wsdl:part name="parameters" element="tns:HelloWorldResponse" />
    </wsdl:message>
    - <wsdl:message name="addSoapIn">
    <wsdl:part name="parameters" element="tns:add" />
    </wsdl:message>
    - <wsdl:message name="addSoapOut">
    <wsdl:part name="parameters" element="tns:addResponse" />
    </wsdl:message>
    - <wsdl:portType name="Service1Soap">
    - <wsdl:operation name="HelloWorld">
    <wsdl:input message="tns:HelloWorldSoapIn" />
    <wsdl:output message="tns:HelloWorldSoapOut" />
    </wsdl:operation>
    - <wsdl:operation name="add">
    <wsdl:input message="tns:addSoapIn" />
    <wsdl:output message="tns:addSoapOut" />
    </wsdl:operation>
    </wsdl:portType>
    - <wsdl:binding name="Service1Soap" type="tns:Service1Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
    - <wsdl:operation name="HelloWorld">
    <soap:operation soapAction="http://Eurotele-it3/WebService1/Service1/HelloWorld" style="document" />
    - <wsdl:input>
    <soap:body use="literal" />
    </wsdl:input>
    - <wsdl:output>
    <soap:body use="literal" />
    </wsdl:output>
    </wsdl:operation>
    - <wsdl:operation name="add">
    <soap:operation soapAction="http://Eurotele-it3/WebService1/Service1/add" style="document" />
    - <wsdl:input>
    <soap:body use="literal" />
    </wsdl:input>
    - <wsdl:output>
    <soap:body use="literal" />
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
    - <wsdl:service name="Service1">
    <documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
    - <wsdl:port name="Service1Soap" binding="tns:Service1Soap">
    <soap:address location="http://eurotele-it3/webService1/Service1.asmx" />
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>

  • Arrays in XSLT Mapping

    Hi,
    Can we use arrays in our XSLT mapping? if yes, please let me know with a example
    Best Regards
    Deepika

    Hi deepika,
    There is no Arrays concept in the XSLT, but there are some ways.
    check this links
    http://bytes.com/groups/xml/87168-xslt-associative-arrays
    http://www.velocityreviews.com/forums/t167975-xslt-associative-arrays.html
    http://www.stylusstudio.com/xsllist/200409/post30980.html
    http://www.stylusstudio.com/xsllist/200102/post41240.html
    Regards
    Ramesh

  • How to pass array into xslt from java

    i have a xslt in which i am passing some parameter from java there is one parameter which is a array in java which i need to pass becouse array length is not defined so that xslt will work dynakically according to the parameter.
    right now i am passing parameter but not able to send the array parameter that's why my code is not fully dynamic
    please give suggestion.
    anagh

    it is not possible to pass array by using XSLT, you can wirite all values into a String with certain delim symbol, pass this string, then use xsl.substring() to get different values.

  • Error in parseXML() when data contains "&"

    Hello,
    I have a Subprocess that is a Loop type. I am calling a web service within the loop. The data is pulled using a database adapter. One of the data values I am passing to the service is "Furniture & amp; Office Equipment" (title). Ignore the space between the & and amp;, I did that so it posts properly. The input data association is using this XPath Expression:
    oraext:parseXML(concat("<CreateCostCodes xmlns:v1='http://xmlns.oracle.com/Primavera/CM/WS/Cost/V1'>
    <v1:CostCode>
    <v1:ProjectName>", bpmn:getDataObject('inputData')/ns2:projectName, "</v1:ProjectName>
    <v1:CostCode>", bpmn:getDataObject('costCodes')/ns:costCodes[bpmn:getActivityInstanceAttribute('SUBPROCESS5114801681331', 'loopCounter')]/ns1:costCode, "</v1:CostCode>
    <v1:Title>", bpmn:getDataObject('costCodes')/ns:costCodes[bpmn:getActivityInstanceAttribute('SUBPROCESS5114801681331', 'loopCounter')]/ns1:title, "</v1:Title>
    </v1:CostCode>
    </CreateCostCodes>"))
    My process is failing when it hits the data containing the title that has the & amp; in it. Can someone suggest how to properly parse this?
    Thank you
    Rudy

    Hi Daniel,
    Yes, I have used the "for each" before but in this case the loop is in the subProcess and my web service call is within the subProcess so I don't want to iterate the array in the XSLT. The Loop Characteristics of the subProcess are: Loop and the loop condition is a simple expression "loopCounter <= costCodes.costCodes.length()". I would like to attach an image of the subProcess but I don't see how to do that. To describe it; for each costCode in the array I want to do a read to see if it exists, if it does, update it, else create it, end.
    Thank you.
    Edited by: Rudy Meyer on Nov 15, 2012 9:56 AM

  • Disappearing of Web Parts and a custom List Views containing XSL

    Hello!
    Recently, on the sites with Web Parts
    containing XSL or on List Views (.aspx-pages) containing
    XSL a message appears:
    Unable to display this Web Part. To troubleshoot the problem, open this Web page in a Microsoft SharePoint Foundation-compatible HTML editor such as Microsoft SharePoint Designer. If the problem persists, contact your Web server administrator.
    Correlation ID:98bcff3d-5cc0-42b6-819c-41d36a4aa335
    And so it is as long as I do not take
    certain actions: indicated below as I
    struggled with this. In a day or two it
    repeats.
    Web Parts and List Views without XSL
    are displayed normal.
    Related LOGs for such Web Parts and List View containing XSL:
    Error while executing web part: System.IndexOutOfRangeException: Index was outside the bounds of the array.
    at Microsoft.Xslt.MethodCollection.ResolveMethodDef(Int32 tokenNum)
    at Microsoft.Xslt.MethodCollection.GetMethodInfo(Int32 methodNumber)
    at Microsoft.Xslt.STransform.GetCompiledTransform()
    at Microsoft.SharePoint.WebPartPages.BaseXsltListWebPart.LoadXslCompiledTransform(WSSXmlUrlResolver someXmlResolver)
    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.GetXslCompiledTransform()
    at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform)
    Herewith:
    1. Updates have been installed on the server
    with a further rebooting.
    2. No doubt the correctness of XSL:
    previously these web parts and list views were displayed.
    And it is displayed in SP Designer.
    My actions for troubleshooting (a day or two
    it reappears):
    For Web Parts containing XSL:
    - Server rebooting does not help.
    - Resaving of Web Part settings
    helps (Web Part menu -> Change Web Part -> OK).
    - Sometimes resaving of Web Part settings does not help. In this case restarting of Application Pool 'SharePoint - 80' with further
    resaving of Web Part settings helps.
    For List Views containing XSL:
    - Server rebooting does not help.
    - Server updating with futher rebooting
    helps.
    - Restarting of Application Pool 'SharePoint - 80'
    helps.

    Hi,
    According to your post, my understanding is that Web Parts and List Views with XSL were displayed unnormal.
    The error message is caused by that the time allowed for doing the XSL transformation was exceeded.
    In SharePoint 2010 the XSL transform cannot take longer than 1 second.
    There is now a hot fix available from Microsoft to resolve this issue,  the solution are at this page:
    http://support.microsoft.com/kb/2639184. 
    In addition, you can install  sharepointfoundation2010-kb2597136-fullfile-x64-glb.exe and use the PowerShell
    script below to make the change to the Timeout value
    If the issue still exists, you can perform an AppPool recycle in IIS.
    More information:
    http://englando.wordpress.com/2012/01/05/unable-to-display-this-web-part-xsltlistview-and-xsltdataview-web-part-issues-in-ie/
    http://hsdhaarsma.blogspot.in/2013/06/indexoutofrangeexception-in.html#!/2013/06/indexoutofrangeexception-in.html
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to use XSLT for mapping feild names one by one to array element

    I have a XSLT case to map all the attributes feild name(not value) which has no child to the target, which is array loop.
    I give an sample below.
    source:
    <Items xmlns="http://www.example.org/sample">
    <SourceSystem>SourceSystem2573</SourceSystem>
    <TimeStamp>2010-01-17T20:54:08.234</TimeStamp>
    <Item>
    <ID>2574</ID>
    <Type>2575</Type>
    <Name>2576</Name>
    </Item>
    </Items>
    source XSD like:
         <element name="Items" type="tns:ItemsType"></element>
         <complexType name="ItemsType">
              <sequence>
                   <element name="SourceSystem" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="TimeStamp" type="dateTime" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Item" type="tns:ItemType"
                        maxOccurs="unbounded" minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    <complexType name="ItemType">
              <sequence>
                   <element name="ID" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
                   <element name="Type" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    <element name="Name" type="string" maxOccurs="1"
                        minOccurs="1">
                   </element>
    </sequence>
         </complexType>
    target need to be like:
    <ns1:AttributesCollection>
    <ns1:Attributes>
    <ns1:fieldname>SourceSystem</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>TimeStamp</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>ID</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Type</ns1:fieldname>
    </ns1:Attributes>
    <ns1:Attributes>
    <ns1:fieldname>Name</ns1:fieldname>
    </ns1:Attributes>
    </ns1:AttributesCollection>
    target XSD:
    <xs:element name="AttributesCollection" type="AttributesCollection"/>
    <xs:complexType name="AttributesCollection">
    <xs:sequence>
    <xs:element name="Attributes" type="Attributes" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Attributes">
    <xs:sequence>
    <xs:element name="fieldname" minOccurs="0">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:maxLength value="100"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>
    I know we can use local-name() to get the tag/field name,
    but I have not idea how to get these leaf field names one by one and then mapping to every array elements.
    I tried whole day but no successful
    Does anyone have some idea?
    Thanks very much!
    Keith
    Edited by: user1065212 on 17-Jan-2010 22:50
    Edited by: user1065212 on 17-Jan-2010 22:53
    Edited by: user1065212 on 17-Jan-2010 22:59

    can you paste source xsd and the correct xml output, the current one isn't really valid
    <ID>2574</TotalNumOfItems>

  • XSLT Transformation ABAP to XML speacial treatment of empty elements

    Dear All,
    I have created a deep abap structure which basically reflects the structure of my XML file which I would like to generate later. I have created a transformation via transaction SE80->create XSLT Program. I am also using the ABAP command call transformation...
    I have made a few ammendments to my XSLT program where required.
    I am outputting data in a loop.
    But I got a problem with one field. I must check if this date field is initial.
    Which I did by using statement:
    <xsl:if test="ENDDATE='0000-00-00'">
    But if this field is initial I have to output the following tag:
    <ENDDATE ReasonForNull="9"></ENDDATE>
    Hence I defined an attribute below in my element as follows:
       <xsl:for-each select="INSTANCE/_-PIQGB_-INSTANCE_XML">
    <xsl:if test="ENDDATE='0000-00-00'">
       <xsl:element name="ENDDATE">
           <xsl:attribute name="ReasonForNull"/>  
        </xsl:element>
    </xsl:if>
       </xsl:for-each>
    Which generates now the output as follows and is quitwe close to the desired output:
    <ENDDATE ReasonForNull=""></ENDDATE>
    Can anybody make a suggestion how I can generate the desired output.
    I assume that I would have to assign a value to the attribute to get the right output. But I got no idea how I could this in the loop.
    Many thanks in advance.
    Rainer

    Hello Rainer
    The solution is quite simple. See the example below.
    " Sample XML file:
    <?xml version="1.0" encoding="UTF-8"?>
    <?xml-stylesheet type="text/xsl" href="../tmp_EDI_ZZ_tests/Untitled2.xsl"?>
    <INVOIC02>
        <INSTANCE>
            <ENDDATE>2008-07-31</ENDDATE>
        </INSTANCE>
        <INSTANCE>
            <ENDDATE>0000-00-00</ENDDATE>
        </INSTANCE>
    </INVOIC02>
    " Stylesheet:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:output encoding="ISO-8859-1" method="xml" indent="yes"/>
        <xsl:template match="/*">
            <xsl:for-each select="INSTANCE">
                <xsl:choose>
                    <xsl:when test="ENDDATE='0000-00-00' ">
                        <xsl:element name="ENDDATE">
                            <xsl:attribute name="ReasonForNull">
                                <xsl:value-of select=" '9' "/>   " Set value for attribute !!!
                            </xsl:attribute>
                        </xsl:element>
                    </xsl:when>
                    <xsl:otherwise>
                        <xsl:copy-of select="node()"/>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:for-each>
        </xsl:template>
    </xsl:stylesheet>
    " Result of transformation:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <ENDDATE>2008-07-31</ENDDATE>
    <ENDDATE ReasonForNull="9"/>
    Regards
      Uwe

  • How can i put the values of the position of a pixel in an array ?

    Hello. I wanted to know if someone can help me with my problem. In fact i have to make an image treatment. For this i put my immage in an array and i work in this array thanks to two For loops. I wanted to know which pixel is white and which one is grey so i made a software and this works very well but know i would like to put the value of X and Y of each white pixel. unfortunately i don t know how to use Labview very well. So i tought about a system based on a conditional loop who put the value of X and Y in two 1D arrays. But i am not able to achieve it. This is what i tried but i don t know how to achieve it. If you guy or girls have solutions to my problem or an other way to do it go on ^^.
    Thanks every one.
    Attachments:
    Untitled.png ‏15 KB

    I am sure you can adapt one of the two solutions shown here.
    LabVIEW Champion . Do more with less code and in less time .

  • Problem converting XML back to ABAP Structure using XSLT

    Hi Experts,
    I am currently trying to convert this xml file back to my ABAP structure but i have been unsuccessful so far. In XML file contain more than 1 reocrd. But my XSLT program is retriving only only first record. Try to help to get all the records.
    Sample XML File:
    Thanks for your help in advance.
    Regards,
    Srini

    here is the XSLT program YSIMPLEXMLTOITAB1
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
      <xsl:template match="/">
        <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
          <asx:values>
            <OUTTAB>
              <xsl:for-each select="//String">
                <ZTEST11>
                  <FINAL_RESULT>
                    <xsl:value-of select="."></xsl:value-of>
                  </FINAL_RESULT>
                </ZTEST11>
              </xsl:for-each>
            </OUTTAB>
          </asx:values>
        </asx:abap>
      </xsl:template>
    </xsl:transform>
    ABAP report program to test this.
    REPORT yjfkdjkfmxl
           NO STANDARD PAGE HEADING.
    DATA: BEGIN OF ztest11  OCCURS 0,
          final_result(220),
          END OF ztest11 .
    DATA: xml_string TYPE string .
    DATA: xslt_error     TYPE REF TO     cx_xslt_exception,
    xslt_message     TYPE     string .
    CLEAR xml_string .
    CONCATENATE
    `<?xml version="1.0" encoding="utf-8"?>`
    `<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> `
    `<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">`
    `<ns:matchResponse xmlns:ns='http://www.openuri.org/'>`
    `<matchResult xsi:type='SOAP-ENC:Array' SOAP-ENC:arrayType='xsd:string[18]'>`
    `<String xsi:type='xsd:string'>23901|EUS|20060625 |ABU NIDAL ORGANISATION||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23934|EUS|20060625 |ABU NIDAL ORGANISATSIOON||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23940|EUS|20060625 |ABU NIDALORGANIZACIJA||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>4228|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||DZ|ALGERIA|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4229|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||LB|LEBANON|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4231|sdme|19950301 605084 19950125|ABU NIDAL ORGANIZATION||||||LY|LIBYAN ARAN JAMAHIRIYA|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4232|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||SD|SUDAN|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>4233|sdme|19950126 605084 19950125|ABU NIDAL ORGANIZATION||||||IQ|IRAQ|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>6643|dto|19971008 6252649 199710086651088 200110056856860 20031002|ABU NIDAL ORGANIZATION||||||XX|ALL|68|56860 |20031002|19971008|20880808</String>`
    `<String xsi:type='xsd:string'>23941|EUS|20060625 |ABU NIDAL SZERVEZET||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>4332|sdme|19950126 605084 19950125|NIDAL, ABU|DOB: May 1937 or 1940||JAFFA|||IL|ISRAEL|60|5084 |19950125|19950123|20880808</String>`
    `<String xsi:type='xsd:string'>23950|EUS|20060625 |ORGANIZACIJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23911|EUS|20060625 |ORGANIZACIÓN ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23946|EUS|20060625 |ORGANIZACJA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23916|EUS|20060625 |ORGANIZAÇÃO ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23955|EUS|20060625 |ORGANIZZAZIONE ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:type='xsd:string'>23949|EUS|20060625 |ORGANIZÁCIA ABU NIDAL||||||XX|ALL||||20060529|20880808</String>`
    `<String xsi:nil='true'></String>`
    `</matchResult>`
    `</ns:matchResponse>`
    `</SOAP-ENV:Body>`
    `</SOAP-ENV:Envelope>`
    INTO xml_string .
    TRY .
        CALL TRANSFORMATION (`YSIMPLEXMLTOITAB1`)
        SOURCE XML  xml_string
        RESULT     outtab = ztest11[].
      CATCH cx_xslt_exception INTO xslt_error.
        xslt_message = xslt_error->get_text( ).
    ENDTRY.
    Regards
    Raja

  • Java Error in RFC Lookup in XSLT Mapping usinf Java helper class

    Hi All,
    I am doing RFC Lookup in XSLT Mapping using Java Helper class.
    The Lookup works fine when called one RFC at a time However my requirement is I want to do 2 Lookups.
    Both Lookups works when done individually however when I call both lookups in one mapping I get following error "javax.xml.transform.TransformerException: DOMSource whose Node is null."
    Following is the code I have written in XSLT for the lookup:
         <xsl:template name="Lookup_1">
              <xsl:param name="STDPN"/>
                   <rfc:RFC_READ_TABLE>
                        <QUERY_TABLE>KNA1</QUERY_TABLE>
                        <OPTIONS><item><TEXT>
                                  <xsl:value-of select="$STDPN"/>
                             </TEXT></item>
                        </OPTIONS>
                        <FIELDS>
                             <item>
                                  <FIELDNAME>KUNNR</FIELDNAME>
                             </item>
                        </FIELDS>
                   </rfc:RFC_READ_TABLE>
              </xsl:variable>
              <xsl:variable name="response" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request, 'BS_D, 'cc_RfcLookup', $inputparam)"/>
              <xsl:element name="STDPN">
                   <xsl:value-of select="$response//DATA/item/WA"/>
              </xsl:element>
         </xsl:template>
         <xsl:template name="Lookup_2">
              <xsl:param name="BELNR"/>
                   <xsl:variable name="Query">AGMNT = '<xsl:value-of select="$BELNR"/>'</xsl:variable>
                   <xsl:variable name="request1">
                        <rfc:RFC_READ_TABLE>
                             <QUERY_TABLE>ZTABLE</QUERY_TABLE>
                             <OPTIONS><item><TEXT>
                                  <xsl:value-of select="$Query"/>
                                  </TEXT></item>
                             </OPTIONS>
                             <FIELDS>
                                  <item>
                                       <FIELDNAME>KUNAG</FIELDNAME>
                                  </item>
                             </FIELDS>
                        </rfc:RFC_READ_TABLE>
                   </xsl:variable>
                   <xsl:variable name="response1" xmlns:lookup="java:urn.mt.pi" select="lookup:execute($request1, 'BS_D','cc_RfcLookup', $inputparam)"/>
                   <xsl:element name="BELNR">
                        <xsl:value-of select="$response1//DATA/item/WA"/>
                   </xsl:element>
         </xsl:template>
    My Question: Am I doing anything wrong? Or Is it possible to call multiple lookups in one XSLT?
    Thanks and Regards,
    Atul

    Hi Atul,
    I had the same problem like you had.
    The main Problem is that with the example code the request variable is created as NodeList object. In XSLT a variable is somekind of a constant and can't be changed. As the request object is empty after the first request the programm fails at the following line:
    Source source = new DOMSource(request.item(0));
    So I've created a workaround for this problem.
    In the call of the template I've put the request as a parameter object at the template call:
    <xsl:with-param name="req">
    <rfc:PLM_EXPLORE_BILL_OF_MATERIAL xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
      <APPLICATION>Z001</APPLICATION>
      <FLAG_NEW_EXPLOSION>X</FLAG_NEW_EXPLOSION>
      <MATERIALNUMBER><xsl:value-of select="value"/></MATERIALNUMBER>
      <PLANT>FSD0</PLANT>
      <VALIDFROM><xsl:value-of select="//Recordset/Row[name='DTM-031']/value"/></VALIDFROM>
      <BOMITEM_DATA/>
    </rfc:PLM_EXPLORE_BILL_OF_MATERIAL>
    </xsl:with-param>
    With this change the request will be provided as a String object and not as a NodeList object.
    Afterwards the RfcLookup.java has to be changed to the following:
    package com.franke.mappings;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import java.io.StringWriter;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Source;
    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.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.lookup.Channel;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.lookup.RfcAccessor;
    import com.sap.aii.mapping.lookup.LookupService;
    import com.sap.aii.mapping.lookup.XmlPayload;
    * @author Thorsten Nordholm Søbirk, AppliCon A/S
    * Helper class for using the XI Lookup API with XSLT mappings for calling RFCs.
    * The class is generic in that it can be used to call any remote-enabled
    * function module in R/3. Generation of the XML request document and parsing of
    * the XML response is left to the stylesheet, where this can be done in a very
    * natural manner.
    * TD:
    * Changed the class that request is sent as String, because of IndexOutOfBound-exception
    * When sending multiple requests in one XSLT mapping.
    public class RfcLookup {
         * Execute RFC lookup.
         * @param request RFC request - TD: changed to String
         * @param service name of service
         * @param channelName name of communication channel
         * @param inputParam mapping parameters
         * @return Node containing RFC response
         public static Node execute( String request,
                 String service,
                 String channelName,
                 Map inputParam)
              AbstractTrace trace = (AbstractTrace) inputParam.get(StreamTransformationConstants.MAPPING_TRACE);
              Node responseNode = null;
              try {
                  // Get channel and accessor
                  Channel channel = LookupService.getChannel(service, channelName);
                  RfcAccessor accessor = LookupService.getRfcAccessor(channel);
                   // Serialise request NodeList - TD: Not needed anymore as request is String
                   /*TransformerFactory factory = TransformerFactory.newInstance();
                   Transformer transformer = factory.newTransformer();
                   Source source = new DOMSource(request.item(0));
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   StreamResult streamResult = new StreamResult(baos);
                   transformer.transform(source, streamResult);*/
                    // TD: Add xml header and remove linefeeds for the request string
                    request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+request.replaceAll("[\r\n]+", ""); 
                    // TD: Get byte Array from request String to send afterwards
                    byte[] requestBytes = request.getBytes();
                   // TD: Not used anymore as request is String
                    //byte[] requestBytes = baos.toByteArray();
                    trace.addDebugMessage("RFC Request: " + new String(requestBytes));
                    // Create input stream representing the function module request message
                    InputStream inputStream = new ByteArrayInputStream(requestBytes);
                    // Create XmlPayload
                    XmlPayload requestPayload =LookupService.getXmlPayload(inputStream);
                    // Execute lookup
                    XmlPayload responsePayload = accessor.call(requestPayload);
                    InputStream responseStream = responsePayload.getContent();
                    TeeInputStream tee = new TeeInputStream(responseStream);
                    // Create DOM tree for response
                    DocumentBuilder docBuilder =DocumentBuilderFactory.newInstance().newDocumentBuilder();
                    Document document = docBuilder.parse(tee);
                    trace.addDebugMessage("RFC Response: " + tee.getStringContent());
                    responseNode = document.getFirstChild();
              } catch (Throwable t) {
                   StringWriter sw = new StringWriter();
                   t.printStackTrace(new PrintWriter(sw));
                   trace.addWarning(sw.toString());
              return responseNode;
         * Helper class which collects stream input while reading.
         static class TeeInputStream extends InputStream {
               private ByteArrayOutputStream baos;
               private InputStream wrappedInputStream;
               TeeInputStream(InputStream inputStream) {
                    baos = new ByteArrayOutputStream();
                    wrappedInputStream = inputStream;
               * @return stream content as String
               String getStringContent() {
                    return baos.toString();
              /* (non-Javadoc)
              * @see java.io.InputStream#read()
              public int read() throws IOException {
                   int r = wrappedInputStream.read();
                   baos.write(r);
                   return r;
    Then you need to compile and upload this class and it should work.
    I hope that this helps you.
    Best regards
    Till

  • How to create an array in bpel?

    I am trying to integrate a web service into open-esb. The web service consumes an unbounded array of a "userInfo" data structure. The issue is that although I can create bpel to receive a message like this, due to type incompatibilities I need to create a different array within bpel to pass to the webservice.
    To date I have not found a way to create an array within open-esb's bpel. After extensive googling I have found that other ESBs define their own proprietary extensions to add nodes to an array.
    Thus I have two questions:
    First, does open-esb support creation of arrays? and if so, how do I create the array and add nodes to it?
    Second, and perhaps more importantly, is using an <assign> activity the best way to transfer a potentially large array from one variable to another (i.e., will it perform well)? Or should I use XSLT to transform the array from one wsdl type to another? And if XSLT is the answer, how can I do this within open-esb?
    Thanks in advance,
    Steve
    PS. Based on the various googlings Ive been doing this question seems to be frequently asked. If someone will help me find a solution I plan on writing a short "how-to" article for posting back to the community. Given that arrays are one of the most basic data structures I hope the article will be useful for others struggling with this issue.

    I think this is all covered in Steve-Nies other thread concerning this subject, entitled "Need help with BPEL please" (http://forum.java.sun.com/thread.jspa?threadID=5116270&tstart=0)

  • Error while transforming XSLT by calling function with Reflection API

    Hi,
    I'm new to Reflection API. I want to call function from the jar file which is not in my application context. So I have loaded that jar ( say XXX.jar) file at runtime with URLClassLoader and call the function say [ *myTransform(Document document)* ]. Problem is that when I want to transform any XSLT file in that function it throws exception 'Could not compile stylesheet'. All required classes are in XXX.jar.
    If I call 'myTransform' function directly without reflection API then it transformation successfully completed.
    Following is code of reflection to invoke function
            ClassLoader contextCL = Thread.currentThread().getContextClassLoader();
            URLClassLoader loader = new URLClassLoader(jarURLs, contextCL);
            Class c = loader.loadClass(fullClasspath);
            Constructor constructor = c.getDeclaredConstructor(constructorParamsClasses);
            Object instance = constructor.newInstance(constructorParams);
            Method method = c.getDeclaredMethod("myTransform", methodParamsClasses);
            Object object = method.invoke(instance, methodParams);Following is function to be called with reflection API.
    public Document myTransform ( Document document ) {
    // Reference of Document (DOM NODE) used to hold the result of transformation.
                Document doc = null ;
                // DocumentBuilderFactory instance which is used to initialize DocumentBuilder to create newDocumentBuilder.
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance () ;
                // Reference of DocumentBuilder used to create new Document (DOM NODE).
                DocumentBuilder builder;
                try {
                      // Initialize DocumentBuilder by using DocumentBuilderFactory instance.
                      builder = factory.newDocumentBuilder ();
                      // Initialize new document instance by using DocumentBuilder instance.
                      doc = builder.newDocument () ;
                      // Creates new DOMSource by using document (DOM NODE) which is coming through current transform() method parameter.
                      DOMSource domsource = new DOMSource ( document ) ;
                      // Creates new instance of TransformerFactory.
                      TransformerFactory transformerfactory = TransformerFactory.newInstance () ;
                      // Creates new Transformer instance by using TransformerFactory which holds XSLT file.
                      Transformer transformer = null;
    ********* exception is thrown from here onward ******************
                      transformer = transformerfactory.newTransformer (new StreamSource (xsltFile));
                      // Transform XSLT on document (DOM NODE) and store result in doc (DOM NODE).
                      transformer.transform ( domsource , new DOMResult ( doc ) ) ;
                } catch (ParserConfigurationException ex) {
                      ex.printStackTrace();
                } catch (TransformerConfigurationException ex) {
                      ex.printStackTrace();
                } catch (TransformerException ex) {
                     ex.printStackTrace();
                } catch (Exception ex) {
                     ex.printStackTrace();
                //holds result of transformation.
                return doc ;
    }Following is full exception stacktrace
    ERROR:  'The first argument to the non-static Java function 'myBeanMethod' is not a valid object reference.'
    FATAL ERROR:  'Could not compile stylesheet'
    javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:829)
            at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:623)
            at com.actl.dxchange.utilities.Transformation.transform(Transformation.java:83)
            at com.actl.dxchange.base.BaseConnector.transform(BaseConnector.java:330)
            at com.actl.dxchange.connectors.KuoniConnector.doRequestProcess(KuoniConnector.java:388)
            at com.actl.dxchange.connectors.KuoniConnector.hotelAvail(KuoniConnector.java:241)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            ...........

    Hi,
    Thanks for response.
    Following is code for setting 'methodParamsClasses' array object. I do ensure that Document is not null and valid. My application is web application.
    Document requestObj = /* my code for generating Document object*/
    Object[] methodParams = new Object[]{requestObj}
    Class[] methodParamsClasses = new Class[]{};
                if (methodParams != null) {
                    methodParamsClasses = new Class[methodParams.length];
                    for (int i = 0; i < methodParams.length; i++) {
                        if (methodParams[i] instanceof Document) {
    /************** if parameter is instance of Document then I set class type as "Document.class" ***********/
                            methodParamsClasses[i] = Document.class;
                        } else {
                            methodParamsClasses[i] = methodParams.getClass();

  • Java Mapping with an xml array as input

    Hi Gurus,
    I have to perform a java mapping to map some input xml contained in an array with a target message type. I have found a good java mapping example here:
    Re: Please provide Java Mapping example
    but my mapping input is not a single XML, but an XML array, thus I have a doubt...
    How can I map multiple XML contained in an array with a target XML? I have to solve this problem into a Java mapping prospective.
    Thanks to all!
    Message was edited by:
            Gabriele Morgante

    Hey Stefan, I think he is refering to a n:1 multimapping.
    If that is indeed the case, Gabriele, you will have to consider the initial tags inserted by mapping runtime to treat multimappings.
    Suppose your XML message is like
    <myMT xmlns="urn:mynamespace">
      <value>xpto</value>
    </myMT>
    Then, if your source message interface occurrence is defined as unbounded in your interface mapping, your mapping program (message mapping, xslt, java mapping, whatever) will receive, from mapping runtime, a message like this:
    <Messages xmlns="http://sap.com/xi/XI/SplitAndMerge">
      <Message1>
        <myMT xmlns="urn:mynamespace">
          <value>xpto1</value>
        </myMT>
        <myMT xmlns="urn:mynamespace">
          <value>xpto2</value>
        </myMT>
        <myMT xmlns="urn:mynamespace">
          <value>xpto3</value>
        </myMT>
      </Message1>
    </Messages>
    Also, if you have more than 1 message type as source of your interface mapping, your mapping program will receive the other message types in <Message2>, <Message3>... tags.
    The <Messages> and <MessageX> tags will always be automatically generated by mapping runtime when dealing with multimappings, which are mappings from m XML messages to n XML messages, with either m, n or both different of 1 (note that this definition includes mappings from 1 type to 1 type, when either source, target or both message types have max occurrence = ubounded).
    Finally, remember that the output that your mapping program generates will also have to include these <Messages> and <MessageX> tags (with proper namespace), since mapping runtime will be expecting them. Message mappings treat those by default, but your xslt and java multimappings will have to explicitely include these tags in the output.
    Regards,
    Henrique.

  • XSLT and Java lookup cache

    Hi,
    I´m trying the "Easy RFC lookup from XSLT mappings using a Java helper class" article and I getting a weird problem.
    The result of the RFC lookup called inside the java class is maintained in a kind of cache and  I always get the same results independent of the parameters I use in the following calls.
    Just after calling a Complete Cache Refresh (SXI_CACHE) I got a new result to the lookup.
    If I call in the Interface Mapping Test option it runs fine. However, when I call it from my scenario (SOAP Adapter Sender) the first result of the lookup will be returned until a forced cache refresh.
    Any ideas?
    Thank you,
    Fabiano.

    Hello Fabiano,
    I had the same problem like you had.
    The main Problem is that with the example code the request variable is created as NodeList object. In XSLT a variable is somekind of a constant and can't be changed. As the request object is empty after the first request the programm fails at the following line:
    Source source = new DOMSource(request.item(0));
    So I've created a workaround for this problem.
    In the call of the template I've put the request as a parameter object at the template call:
    <xsl:with-param name="req">
    <rfc:PLM_EXPLORE_BILL_OF_MATERIAL xmlns:rfc="urn:sap-com:document:sap:rfc:functions">
      <APPLICATION>Z001</APPLICATION>
      <FLAG_NEW_EXPLOSION>X</FLAG_NEW_EXPLOSION>
      <MATERIALNUMBER><xsl:value-of select="value"/></MATERIALNUMBER>
      <PLANT>FSD0</PLANT>
      <VALIDFROM><xsl:value-of select="//Recordset/Row[name='DTM-031']/value"/></VALIDFROM>
      <BOMITEM_DATA/>
    </rfc:PLM_EXPLORE_BILL_OF_MATERIAL>
    </xsl:with-param>
    With this change the request will be provided as a String object and not as a NodeList object.
    Afterwards the RfcLookup.java has to be changed to the following:
    package com.franke.mappings;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PrintWriter;
    import java.io.StringWriter;
    import java.util.Map;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Source;
    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.Node;
    import org.w3c.dom.NodeList;
    import com.sap.aii.mapping.lookup.Channel;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.lookup.RfcAccessor;
    import com.sap.aii.mapping.lookup.LookupService;
    import com.sap.aii.mapping.lookup.XmlPayload;
    * @author Thorsten Nordholm Søbirk, AppliCon A/S
    * Helper class for using the XI Lookup API with XSLT mappings for calling RFCs.
    * The class is generic in that it can be used to call any remote-enabled
    * function module in R/3. Generation of the XML request document and parsing of
    * the XML response is left to the stylesheet, where this can be done in a very
    * natural manner.
    * TD:
    * Changed the class that request is sent as String, because of IndexOutOfBound-exception
    * When sending multiple requests in one XSLT mapping.
    public class RfcLookup {
         * Execute RFC lookup.
         * @param request RFC request - TD: changed to String
         * @param service name of service
         * @param channelName name of communication channel
         * @param inputParam mapping parameters
         * @return Node containing RFC response
         public static Node execute( String request,
                 String service,
                 String channelName,
                 Map inputParam)
              AbstractTrace trace = (AbstractTrace) inputParam.get(StreamTransformationConstants.MAPPING_TRACE);
              Node responseNode = null;
              try {
                  // Get channel and accessor
                  Channel channel = LookupService.getChannel(service, channelName);
                  RfcAccessor accessor = LookupService.getRfcAccessor(channel);
                   // Serialise request NodeList - TD: Not needed anymore as request is String
                   /*TransformerFactory factory = TransformerFactory.newInstance();
                   Transformer transformer = factory.newTransformer();
                   Source source = new DOMSource(request.item(0));
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   StreamResult streamResult = new StreamResult(baos);
                   transformer.transform(source, streamResult);*/
                    // TD: Add xml header and remove linefeeds for the request string
                    request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+request.replaceAll("[\r\n]+", ""); 
                    // TD: Get byte Array from request String to send afterwards
                    byte[] requestBytes = request.getBytes();
                   // TD: Not used anymore as request is String
                    //byte[] requestBytes = baos.toByteArray();
                    trace.addDebugMessage("RFC Request: " + new String(requestBytes));
                    // Create input stream representing the function module request message
                    InputStream inputStream = new ByteArrayInputStream(requestBytes);
                    // Create XmlPayload
                    XmlPayload requestPayload =LookupService.getXmlPayload(inputStream);
                    // Execute lookup
                    XmlPayload responsePayload = accessor.call(requestPayload);
                    InputStream responseStream = responsePayload.getContent();
                    TeeInputStream tee = new TeeInputStream(responseStream);
                    // Create DOM tree for response
                    DocumentBuilder docBuilder =DocumentBuilderFactory.newInstance().newDocumentBuilder();
                    Document document = docBuilder.parse(tee);
                    trace.addDebugMessage("RFC Response: " + tee.getStringContent());
                    responseNode = document.getFirstChild();
              } catch (Throwable t) {
                   StringWriter sw = new StringWriter();
                   t.printStackTrace(new PrintWriter(sw));
                   trace.addWarning(sw.toString());
              return responseNode;
         * Helper class which collects stream input while reading.
         static class TeeInputStream extends InputStream {
               private ByteArrayOutputStream baos;
               private InputStream wrappedInputStream;
               TeeInputStream(InputStream inputStream) {
                    baos = new ByteArrayOutputStream();
                    wrappedInputStream = inputStream;
               * @return stream content as String
               String getStringContent() {
                    return baos.toString();
              /* (non-Javadoc)
              * @see java.io.InputStream#read()
              public int read() throws IOException {
                   int r = wrappedInputStream.read();
                   baos.write(r);
                   return r;
    Then you need to compile and upload this class and it should work.
    I hope that this helps you.
    Best regards
    Till

Maybe you are looking for

  • Hp TrueVision HD web cam does not work. The light will come on but no image appears in the window.

    Hi.  I have an HP Pavilion dv7 6178us Entertainment PC I just bought it last week. My operating system is Windows 7 Home Premium Service Pack 1 64 bits. The problem I have is that yesterday I install Skype in the computer and realized that the HP Tru

  • FLASH PLAYER 11 LSO Privacy vs Storage Persistence of User Data

    Any plans in Flash Player 11 for striking a more even balance between: 1) Users for whom Flash LSO a.k.a. cookies, provide crucial cross-session storage of data for Games and Applications; and 2) Users who do NOT want flash cookies at all ? In the Cu

  • How to dissasociate Firefox from Internet Explorer?

    I have IE 8 and FF 5 on Win7 machine. Sometimes when I click a link in IE, it brings it up in FF. Also, all IE windows I have open also open in FF. I want to uninstall FF because I really don't use it anymore, but am unsure of the consequences becaus

  • In adobe Encore "internal software error"

    If you try to create a DVD image in adobe encore, It is not possible to create is displayed: "Volumes / Builds / Amawat / Main / XcodeProjects / AuthorCore / / / Sonic / DVDCreator / FormatL ib / Vobulator / BlockPlanner.cpp, line 217 internal softwa

  • Texas hold em' dont work

    i have restored my ipod and synced the game over and over, but it says error: this game cannot be played. connect ur ipod to itunes and re-install the game for additional information , please visit http:////apple.com/support/ipod, and i did, but noth