cancel
Showing results for 
Search instead for 
Did you mean: 

Need XSLT/JAVA mapping

former_member694142
Participant
0 Kudos

Hi Experts,

I am working on Webservice to Webservice SYNC scenario,

My query is i am able to get the response but the response format doesn't match the format required in PI mapping.

Response format from third party is as follow:

<ns1:getFoodNameResponse xmlns:ns1='http://http.service.test.com' soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' 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'><getFoodNameReturn xsi:type='xsd:string'>Your food name is :IDLI</getFoodNameReturn></ns1:getFoodNameResponse>

whereas we require below format in PI:

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

<ns0:getFoodNameResponse xmlns:ns0="http://http.service.test.com">

   <ns0:getFoodNameReturn>IDLI</ns0:getFoodNameReturn>

</ns0:getFoodNameResponse>

Can anyone provide XSLT or Java mapping for the same?

It's urgent..Please help

Accepted Solutions (1)

Accepted Solutions (1)

former_member186851
Active Contributor
0 Kudos

Hello Ashsih,

If your using WSDL from webservice,Why don't you try mapping with Graphical mapping instead of XSLT mapping

former_member694142
Participant
0 Kudos

Hi Raghu,

I don't think it is feasible using graphical mapping.

If yes, kindly help me how to proceed. Please provide screenshot of mapping if possible.

Thanks in advance!

former_member186851
Active Contributor
0 Kudos

Ashish,

Can I have the WSDL and O/P format required.

former_member182412
Active Contributor
0 Kudos

Hi Ashish,

I just tested in message mapping it is working, what is your PI version?

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

As Praveen tested and I suggested Graphical mapping iwll do ashish as you dont have any headers.

former_member694142
Participant
0 Kudos

Hi Praveen,

My PI version is 7.40. For me it's not working

former_member186851
Active Contributor
0 Kudos

Hello Ashish,

What error your getting?

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Ashish,

The response look like it is rpc encoded. In the external definition, there is an option to use RPC instead of literal. Can you try it?

Regards,

Mark

former_member694142
Participant
0 Kudos

Hi Raghu,

Request mapping is working fine. But when we recieve a response from third party it comes in below format.

<ns1:getFoodNameResponse xmlns:ns1='http://http.service.test.com' soapenv:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' 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'><getFoodNameReturn xsi:type='xsd:string'>Your food name is : Grapes</getFoodNameReturn></ns1:getFoodNameResponse>

This gives error in the response mapping as it is not in the expected xml format.

It creates empty xml like this:

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

<ns1:MT1 xmlns:ns1="http://Sample.com/dummy_test"></ns1:MT1>

whereas the expected response should be in below format:

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

<ns0:getFoodNameResponse xmlns:ns0="http://http.service.test.com">

<ns0:getFoodNameReturn>Mango</ns0:getFoodNameReturn>

</ns0:getFoodNameResponse>

So i need a xslt mapping or UDF code so that i can convert the response coming from third party to the required format.

former_member694142
Participant
0 Kudos

Hi Mark,

Thanks for the reply.

It's giving me below error by changing it to RPC style.

"Unable to convert imported document to WSDL

Reason:

A Part element must be assigned RPC Style format by a Type attributeCheck selected category"

former_member182412
Active Contributor
0 Kudos

Hi Ashish,

Did you create the message type and service interface manually or did you refer third party wsdl in service interface and in the mapping??

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Ashish,

For the response import the WSDL and use the same in interface ,message mapping and operation mapping.

and in the reponse mapping map this WSDL to the normal message,it will work.

former_member694142
Participant
0 Kudos

Hi Raghu,

If am using the response structure as a wsdl file, it's giving below error:

former_member694142
Participant
0 Kudos

Hi Praveen,

I have not manually created the structure, directly using WSDL for mapping and service interface.

former_member182412
Active Contributor
0 Kudos

Hi Ashish,

You can use below XSLT mapping.


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

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

   <xsl:template match="/">

      <ns0:getFoodNameResponse xmlns:ns0="http://http.service.test.com">

         <ns0:getFoodNameReturn>

            <xsl:value-of select="/ns0:getFoodNameResponse/getFoodNameReturn"/>

         </ns0:getFoodNameReturn>

      </ns0:getFoodNameResponse>

   </xsl:template>

</xsl:stylesheet>

Regards,

Praveen.

former_member694142
Participant
0 Kudos

Hi Praveen,

I tested by doing multimapping in OM. PFA screenshots.

It is not fetching the value. Kindly guide me where am going wrong

former_member186851
Active Contributor
0 Kudos

Ashsih,

Please post ur message mappign screenshot

former_member694142
Participant
0 Kudos

Hi Praveen,

It is working as expected now. May be the changes where not getting reflected initially.

Thank you so much for your time and sharing your knowledge

Answers (0)