cancel
Showing results for 
Search instead for 
Did you mean: 

Modify SOAP Request Parameters for Element + Header | PI dual Stack

openrico
Participant
0 Kudos

Hi professionals,

I have a SOAP scenario. I want to call a SOAP service from a third party vendor.

First of all I test the request in SOAPUI.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://invers.com/cocosoft/invoices/" xmlns:inv1="http://invers.com" xmlns:inv2="http://schemas.datacontract.org/2004/07/Invers.Tools.Search.Interface" >

   <soapenv:Header/>

   <soapenv:Body>

      <inv:SearchInvoice>

         <!--Optional:-->

         <inv:id>

            <inv1:SystemuserId>125</inv1:SystemuserId>

            <inv1:Token>e5a542c0-3ba3-40f0-bb3c-91409587afe2</inv1:Token>

         </inv:id>

         <!--Optional:-->

         <inv:list>

            <!--Optional:-->

            <inv2:ListOfJunctions>

               <!--Zero or more repetitions:-->

               <inv2:JunctionList>

                  <!--Optional:-->

                  <inv2:ListOfSearchObjects>

                     <!--Zero or more repetitions:-->

                     <inv2:SearchObject>

                        <!--Optional:-->

                        <inv2:PropertyToSearchName>No</inv2:PropertyToSearchName>

                        <!--Optional:-->

                        <inv2:SearchComparer>GreaterThan</inv2:SearchComparer>

                        <!--Optional:-->

                        <inv2:Value>0</inv2:Value>

                     </inv2:SearchObject>

                  </inv2:ListOfSearchObjects>

                  <!--Optional:-->

                  <inv2:SearchJunctionType>Conjunction</inv2:SearchJunctionType>

               </inv2:JunctionList>

            </inv2:ListOfJunctions>

            <!--Optional:-->

            <inv2:OuterJunctionType>Conjunction</inv2:OuterJunctionType>

         </inv:list>

        

      </inv:SearchInvoice>

   </soapenv:Body>

</soapenv:Envelope>

But I need the following (bold parameters) in the PI, otherwise the Server doesn't accept my request and I get the error:

End element 'Value' from namespace 'http://schemas.datacontract.org/2004/07/Invers.Tools.Search.Interface' expected. Found text '0'. Line 25, position 38. Btw. Value has the type "Anytype". It doesn't matter if I change the type to int in the wsdl.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:inv="http://invers.com/cocosoft/invoices/" xmlns:inv1="http://invers.com" xmlns:inv2="http://schemas.datacontract.org/2004/07/Invers.Tools.Search.Interface" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://www.w3.org/2001/XMLSchema">

   <soapenv:Header/>

   <soapenv:Body>

      <inv:SearchInvoice>

         <!--Optional:-->

         <inv:id>

            <inv1:SystemuserId>125</inv1:SystemuserId>

            <inv1:Token>e5a542c0-3ba3-40f0-bb3c-91409587afe2</inv1:Token>

         </inv:id>

         <!--Optional:-->

         <inv:list>

            <!--Optional:-->

            <inv2:ListOfJunctions>

               <!--Zero or more repetitions:-->

               <inv2:JunctionList>

                  <!--Optional:-->

                  <inv2:ListOfSearchObjects>

                     <!--Zero or more repetitions:-->

                     <inv2:SearchObject>

                        <!--Optional:-->

                        <inv2:PropertyToSearchName>No</inv2:PropertyToSearchName>

                        <!--Optional:-->

                        <inv2:SearchComparer>GreaterThan</inv2:SearchComparer>

                        <!--Optional:-->

                        <inv2:Value i:type="b:int">0</inv2:Value>

                     </inv2:SearchObject>

                  </inv2:ListOfSearchObjects>

                  <!--Optional:-->

                  <inv2:SearchJunctionType>Conjunction</inv2:SearchJunctionType>

               </inv2:JunctionList>

            </inv2:ListOfJunctions>

            <!--Optional:-->

            <inv2:OuterJunctionType>Conjunction</inv2:OuterJunctionType>

         </inv:list>

        

      </inv:SearchInvoice>

   </soapenv:Body>

</soapenv:Envelope>

So i need to change the parameters in the Call and the Header.

How can i achieve this in SAP PI?

Thanks for your help.

Best regards

Enrico

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

Hi Erekle-Enrico!

You could use XSLT transformation to produce desired result:

<?xml version='1.0'?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

   xmlns:inv2="http://schemas.datacontract.org/2004/07/Invers.Tools.Search.Interface"

   xmlns:i="http://www.w3.org/2001/XMLSchema-instance">

<xsl:template match="@*|node()">

  <xsl:copy>

  <xsl:apply-templates select="@*|node()"/>

  </xsl:copy>

</xsl:template>

<xsl:template match="inv2:Value">

  <xsl:copy>

  <xsl:attribute name="i:type">int</xsl:attribute>

  <xsl:apply-templates select="@*|node()"/>

  </xsl:copy>

</xsl:template>

</xsl:stylesheet>

It's worth saying that "b:int" construction has no meaning as processor treats it just like a string value of attribute and doesn't add any namespace definitions for it.

Regards, Evgeniy.

openrico
Participant
0 Kudos

Hi Evgeniy,

thanks for reply. I will try your advice and give you feedback.

Regards,

Enrico

openrico
Participant
0 Kudos

Hi Evgeniy,

i tried a lot with your XSLT transformation. Your last sentence was the solution to the problem. I defined a new attribute called <xsl:attribute name="b:int"></xsl:attribute> in the Value tamplate with no content.

Now the processor adds the right namespace.

I'm really thankful.

Best regards,

Enrico

Answers (1)

Answers (1)

former_member190293
Active Contributor
0 Kudos

Hi Erekle-Enrico!

Are you sure that you need any additional transformations for that?

As far as I could understand you just need element of type "xsd:int" in your structure.

If you use external definition it must be defined as int in xsd schema. If you design your own data type, just set element type to "xsd:int".

Regards, Evgeniy.