cancel
Showing results for 
Search instead for 
Did you mean: 

Can't use WSDL for proxy

Former Member
0 Kudos

Hi,

I have scenario for proxy to SOAP Asycn. For SOAP we have WSDL provided by 3rd party which has request structure

To avoid mapping, i used the request structure as Inbound & outbound service interface in ESR.

While generating proxy i am getting the fields added with <n0... which is causing the SOAP to reject the content

Can you advice, if i can use the WSDL for creating  inbound & outbound service interface or i should create separate Data type for request from ECC.

PS: The only reason why i am using WSDL for both is since the SOAP structure is deeply nested & would be time to create it.

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,


While generating proxy i am getting the fields added with <n0... which is causing the SOAP to reject the content

ns0 or n0 is normal and is standard proxy behavior. What do you mean the soap rejects content? Is it really checking the namespace prefixes? Try using java mapping or xslt to change n0/ns0 to the soap prefix and see if that works.

Regards,

Mark

Former Member
0 Kudos

Hi Thanks for reply.

Ns0 is coming in all fields. Can you point out me to sample of code that i can use for XSLT or Java.

markangelo_dihiansan
Active Contributor
iaki_vila
Active Contributor
0 Kudos

Hi Techie,

You try using XMLAnonimizer bean for standard solution

However with XSL mapping is easy to do it, you have some examples, one in stackoverflow How to remove namespaces from XML using XSLT - Stack Overflow

Regards.

Former Member
0 Kudos

Thanks for quick reply. I have source structure in PROXY that looks like

     <n0:PObject_Customer xmlns:n0="http://www.XXXX.com/">

-       <n0:PObject_Customers_Body>

- <n0:Header>

<n0:ID>4949494</n0:IntegrationObjectID>

<n0:Timestamp>2015-02-09 08:00:01</n0:Timestamp>

<n0:MessageID>CAB690C8-A934-4E71-966E-A573BE7EEBF1</n0:MessageID>

<n0:Sender>SAP</n0:Sender>

<n0:Function>Update</n0:Function>

</n0:Header>

- <n0:Body>

- <n0:Customer>

Every element in SPROXY has </n0

I have payload( that i tested from SOAP UI) that works & looks like

So i want to send the payload as below to 3rd party service.

<acc:PObject_Customer

         <acc:PObject_Customers_Body>

            <Header>

               <ID>4949494</IntegrationObjectID>

               <Timestamp>2015-02-09 08:00:01</Timestamp>

               <MessageID>CAB690C8-A934-4E71-966E-A573BE7EEBF1</MessageID>

               <Sender>SAP</Sender>

               <Function>Update</Function>

            </Header>

            <Body>

               <Customer>

       

<acc is only at first two tags PObject_Customer & PObject_Customers_Body and at the end.

Can you please advice the XSLT or Bean for this change in PI.

Thanks for your time!



iaki_vila
Active Contributor
0 Kudos

Hi Techie,

First of all you need to set a namespace for acc, in my example i set "http://accNamespace.com"

Your source XML is not well-formed and i've changed some tags to do the XSL.

Source XML:


<n0:PObject_Customer xmlns:n0="http://www.XXXX.com/">

<n0:PObject_Customers_Body>

<n0:Header>

<n0:ID>4949494</n0:ID>

<n0:Timestamp>2015-02-09 08:00:01</n0:Timestamp>

<n0:MessageID>CAB690C8-A934-4E71-966E-A573BE7EEBF1</n0:MessageID>

<n0:Sender>SAP</n0:Sender>

<n0:Function>Update</n0:Function>

</n0:Header>

  <n0:Body>

<n0:Customer>moreData</n0:Customer>

</n0:Body>

</n0:PObject_Customers_Body>

</n0:PObject_Customer>

XSL to do the transformation:


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

    <xsl:output indent="yes" method="xml" encoding="utf-8"/>

    <!-- template to remove namespaces -->

    <xsl:template match="*">

          <xsl:element name="{local-name()}">

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

          </xsl:element>

    </xsl:template>

    <!-- template to remove the two first tags -->

    <xsl:template match="/*|n0:PObject_Customers_Body">

          <xsl:apply-templates/>

    </xsl:template>

    <xsl:template match="/">

    <acc:PObject_Customer xmlns:acc="http://accNamespace.com">

         <acc:PObject_Customers_Body>

            <xsl:apply-templates/>

     </acc:PObject_Customers_Body>

    </acc:PObject_Customer>

      </xsl:template>

</xsl:stylesheet>

Output XML:


<?xml version="1.0" encoding="utf-8"?>

<acc:PObject_Customer xmlns:acc="http://accNamespace.com" xmlns:n0="http://www.XXXX.com/">

<acc:PObject_Customers_Body>

<Header>

<ID>4949494</ID>

<Timestamp>2015-02-09 08:00:01</Timestamp>

<MessageID>CAB690C8-A934-4E71-966E-A573BE7EEBF1</MessageID>

<Sender>SAP</Sender>

<Function>Update</Function>

</Header>

<Body>

<Customer>moreData</Customer>

</Body>

</acc:PObject_Customers_Body>

</acc:PObject_Customer>

Hope this helps.

Regards.

Former Member
0 Kudos

Thanks for quick rely. After trying the above XSL, i am getting additional <PObject_Customers_Body>

<?xml version="1.0" encoding="utf-8"?>

<acc:PObject_Customer xmlns:acc="http://accNamespace.com" xmlns:n0="http://www.XXXX.com/">

<acc:PObject_Customers_Body>

<PObject_Customers_Body>

<Header>

<ID>4949494</ID>

<Timestamp>2015-02-09 08:00:01</Timestamp>

<MessageID>CAB690C8-A934-4E71-966E-A573BE7EEBF1</MessageID>

<Sender>SAP</Sender>

<Function>Update</Function>

</Header>

<Body>

<Customer>moreData</Customer>

</Body>

</PObject_Customers_Body>

</acc:PObject_Customers_Body>

</acc:PObject_Customer>

Also my output has to be <acc:PObject_Customer> and remove all the xmlns:acc="http://accNamespace.com" xmlns:n0="http://www.XXXX.com/">

Can you advice & thanks for your time!

Former Member
0 Kudos

Hi Iñaki Vila,

Thanks for your support. Please advice if you are getting 2 tags as when i tested, i am getting 2 PObject_Customers_Body> as shown above

Regds

iaki_vila
Active Contributor
0 Kudos

Hi Techie,

I forgot to omit the n0 namespace with this works perfectly:


<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:n0="http://www.XXXX.com/" exclude-result-prefixes="n0">

    <xsl:output indent="yes" method="xml" encoding="utf-8"/>

    <!-- template to remove namespaces -->

    <xsl:template match="*">

        <xsl:element name="{local-name()}">

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

        </xsl:element>

    </xsl:template>

    <!-- template to remove the two first tags -->

    <xsl:template match="/*|n0:PObject_Customers_Body">

        <xsl:apply-templates/>

    </xsl:template>

    <xsl:template match="/">

        <acc:PObject_Customer xmlns:acc="http://accNamespace.com">

            <acc:PObject_Customers_Body>

                <xsl:apply-templates/>

            </acc:PObject_Customers_Body>

        </acc:PObject_Customer>

    </xsl:template>

</xsl:stylesheet>

I haven't got any duplicated line for PObject_Customers_Body, what is your source XML?

About the namespace acc, if you don't set its value you will construct an invalid XML, it's obligatory in XML determine the namespace value if you set namespace in one tag.

Regards.

Former Member
0 Kudos

This is my source

  

<n0:PObject_Customer xmlns:n0="http://www.XXXX.com/">

<n0:PObject_Customers_Body>

  <n0:Header>

   <n0:IntegrationObjectID>Customers</n0:IntegrationObjectID>

   <n0:Timestamp>2015-01-09 00:03:41</n0:Timestamp>

   <n0:MessageID>C81690C8-A934-4E71-966E-A573BE7EEBF1</n0:MessageID>

   <n0:Sender>SAPQA</n0:Sender>

   <n0:Function>U</n0:Function>

  </n0:Header>

  <n0:Body>

   <n0:Customer>

    <n0:Status>n</n0:Status>

    <n0:HostSource>SAP</n0:HostSource>

    <n0:ID>70102010123</n0:ID>

    <n0:NASID>5678</n0:NASID>

    <n0:BusinessTemplate>Customer</n0:BusinessTemplate>

    <n0:Name>Test_PI_CUSTOMER</n0:Name>

    <n0:MainAddress>

     <n0:PostBox>235 Central Ave SW1</n0:PostBox>

     <n0:ZipCode>30303</n0:ZipCode>

     <n0:City>Atlanta</n0:City>

     <n0:County>US</n0:County>

    </n0:MainAddress>

    <n0:SalesOrg>

     <n0:SalesOrgID>1000</n0:SalesOrgID>

     <n0:Roles>

      <n0:IsTradeOrg>

       <n0:Available>1</n0:Available>

      </n0:IsTradeOrg>

      <n0:IsPayer>

       <n0:Available>1</n0:Available>

       <n0:DefaultCurrency>USD</n0:DefaultCurrency>

      </n0:IsPayer>

      <n0:IsAvailableForPromotions>

       <n0:Available>1</n0:Available>

      </n0:IsAvailableForPromotions>

      <n0:IsAvailableForListing>

       <n0:Available>1</n0:Available>

      </n0:IsAvailableForListing>

      <n0:IsWholesaler>

       <n0:Available>1</n0:Available>

      </n0:IsWholesaler>

      <n0:IsBillTo>

       <n0:Available>1</n0:Available>

      </n0:IsBillTo>

     </n0:Roles>

    </n0:SalesOrg>

   </n0:Customer>

  </n0:Body>

</n0:PObject_Customers_Body>

</n0:PObject_Customer>

And when i test from SAOP UI following works.. so i need to convert into this format

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acc="http://www.XXXX.com/">

   <soapenv:Header/>

   <soapenv:Body>

      <acc:PObject_Customer>     

         <acc:PObject_Customers_Body>

            <Header>

               <IntegrationObjectID>Customers</IntegrationObjectID>

               <Timestamp>2015-02-09 08:00:01</Timestamp>

               <MessageID>CAB690C8-A934-4E71-966E-A573BE7EEBF1</MessageID>

               <Sender>SAPQA</Sender>

               <Function>U</Function>

            </Header>

            <Body>

               <Customer>   

                  <Status>n</Status>

                  <!--Optional:-->

                  <HostSource>SAP</HostSource>

                  <ID>70102010123</ID>            

                  <NASID>5678</NASID>               

                  <BusinessTemplate>Customer</BusinessTemplate>

                  <Name>Test_PI_CUSTOMER</Name>

                  <MainAddress>

                     <Street>235 Central Ave SW1</Street>

                     <ZipCode>30303</ZipCode>

                     <City>Atlanta</City>

                     <Country>us</Country>

                  </MainAddress>

                  <SalesOrg>

                     <SalesOrgID>1000</SalesOrgID>

                     <Roles>

                        <IsTradeOrg>

                           <Available>1</Available>

                        </IsTradeOrg>

                        <IsPayer>

                           <Available>1</Available>

                           <DefaultCurrency>USD</DefaultCurrency>

                        </IsPayer>

                        <IsAvailableForPromotions>

                           <Available>1</Available>

                        </IsAvailableForPromotions>

                        <IsAvailableForListing>

                           <Available>1</Available>

                        </IsAvailableForListing>

                        <IsWholesaler>

                           <Available>0</Available>

                        </IsWholesaler>

                        <IsBillTo>

                           <Available>1</Available>

                        </IsBillTo>

                     </Roles>

                  </SalesOrg>

               </Customer>

            </Body>

         </acc:PObject_Customers_Body>

      </acc:PObject_Customer>

   </soapenv:Body>

</soapenv:Envelope>

Please let me know if we can use the XSLT you mentioned for this &appreciate your time on this.

iaki_vila
Active Contributor
0 Kudos

Hi Techie,

The easy way is to mark in your receiver SOAP channel: Do not Use SOAP Envelope.

Therefore you can wrap at mapping the SOAP envelope.

With this XSL:


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

<xsl:output indent="yes" method="xml" encoding="utf-8"/>

<!-- template to remove namespaces -->

<xsl:template match="*">

<xsl:element name="{local-name()}">

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

</xsl:element>

</xsl:template>

<!-- template to remove the two first tags -->

<xsl:template match="/*|n0:PObject_Customers_Body"  xmlns:n0="http://www.XXXX.com/">

<xsl:apply-templates/>

</xsl:template>

<!-- template to copy the final XML -->

<xsl:template match="/">

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acc="http://www.XXXX.com/">

   <soapenv:Header/>

   <soapenv:Body>

<acc:PObject_Customer>

<acc:PObject_Customers_Body>

<xsl:apply-templates/>

</acc:PObject_Customers_Body>

</acc:PObject_Customer>

  </soapenv:Body>

</soapenv:Envelope>

</xsl:template>

</xsl:stylesheet>

You will get your desired XML:


<?xml version="1.0" encoding="utf-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:acc="http://www.XXXX.com/">

<soapenv:Header/>

<soapenv:Body>

<acc:PObject_Customer>

<acc:PObject_Customers_Body>

<Header>

<IntegrationObjectID>Customers</IntegrationObjectID>

<Timestamp>2015-01-09 00:03:41</Timestamp>

<MessageID>C81690C8-A934-4E71-966E-A573BE7EEBF1</MessageID>

<Sender>SAPQA</Sender>

<Function>U</Function>

</Header>

<Body>

<Customer>

<Status>n</Status>

<HostSource>SAP</HostSource>

<ID>70102010123</ID>

<NASID>5678</NASID>

<BusinessTemplate>Customer</BusinessTemplate>

<Name>Test_PI_CUSTOMER</Name>

<MainAddress>

<PostBox>235 Central Ave SW1</PostBox>

<ZipCode>30303</ZipCode>

<City>Atlanta</City>

<County>US</County>

</MainAddress>

<SalesOrg>

<SalesOrgID>1000</SalesOrgID>

<Roles>

<IsTradeOrg>

<Available>1</Available>

</IsTradeOrg>

<IsPayer>

<Available>1</Available>

<DefaultCurrency>USD</DefaultCurrency>

</IsPayer>

<IsAvailableForPromotions>

<Available>1</Available>

</IsAvailableForPromotions>

<IsAvailableForListing>

<Available>1</Available>

</IsAvailableForListing>

<IsWholesaler>

<Available>1</Available>

</IsWholesaler>

<IsBillTo>

<Available>1</Available>

</IsBillTo>

</Roles>

</SalesOrg>

</Customer>

</Body>

</acc:PObject_Customers_Body>

</acc:PObject_Customer>

</soapenv:Body>

</soapenv:Envelope>

Don't forget if your scenario is synchronous you will to extract the SOAP body in the response.

Hope this helps.

Regards.

Former Member
0 Kudos

Thanks for your help on this. This works now & i am able to post the SOAP request.

Answers (0)