cancel
Showing results for 
Search instead for 
Did you mean: 

Extract xml data from cdata content

Amitjadhav90
Explorer
0 Kudos

Hello Experts,

I am doing proxy to SOAP scenario in which i am getting the SOAP Response as single output parameter with the . All the output parameters are inside CDATA tag as shown below,

How can i get the xml data ???

I have created the target response structure same as it is received from SOAP response.

I have refer some SCN discussion about xslt and java mapping for which i am a beginner .

Is there any other way to handle this ??

Please reply ASAP.

Best Regards,

Amit

Accepted Solutions (0)

Answers (2)

Answers (2)

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

You can also achieve this using XSLT code as follows:

Please check:

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

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:ns0="Enter Your Namespace here">

<xsl:template match="/">

<xsl:element name="getCRRecordResponse">

<xsl:value-of select="//ns0:getCRRecordResponse" disable-output-escaping="yes"/>

</xsl:element>

</xsl:template>

</xsl:stylesheet>

Regards,

Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Thanks for your reply.

I am following the same method for this but i need some guidance on it .

As my response will be SOAP response (External Definition) so what and how will be the namespace name ?

I have not worked with the XSLT Mapping of the external definition..

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

1. You need to add this .xsl file (in zip format) under Imported Archive.

2. In your Operation Mapping for Response (go to Response Tab) select XSL type Mapping from drop down and refer the XSL from your Imported Archive

3. Your Response Proxy Structure needs to be in the same format/hierarchy as generated in the Response structure (CDATA elements in XML should match with the Response Proxy Structure).

4. The Namespace in XSL should refer to the Response Proxy Data Structure namespace, i.e the one in which you have created your Proxy Structure.

Hope it helps.

Regards,

Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

i have created the response structure same as the proxy structure but i am not getting any value when i test OM in test mode.

Also i am getting error while testing the complete cycle , snap as below,

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

How are you testing this flow? Using Sproxy ?

Please check in the Error log, where exactly is the message failing - In Request or Response Mapping?

Also when you do Standalone testing in OM in ESR, you can just test either the Request or Response Mapping, you need to select the correct type and pass correct test data...pls share the screenshot for OM testg also..

Regards,
Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Yes i was testing it from SPROXY.

I think the error is for the request . In request also i have the cdata to pass the input to web service.

Can you tell me how to pass data to cdata parameter?

Below is the screenshot of OM request and response.

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

I believe in SPROXY you can pass the required CDATA text as you did in OM Testing...Not sure what you mean by: Can you tell me how to pass data to cdata parameter?

For more details on CDATA you can refer to following links

What does &amp;lt;![CDATA[]]&amp;gt; in XML mean? - Stack Overflow

XML CDATA

Also check in MONI error log for the exact error (give screenshot)

Hope it helps.

Regards,

Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Leave the question :

Can you tell me how to pass data to cdata parameter


I have provided the screenshot of the response message mapping in the previous comment but after xslt mapping running i am not getting the data return .


Please tell me that what might be wrong in the XSLT file.


Below is the image of the moni error.

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

Can you give / check the entire Error log in that screen...what I see in it is SOAP Call Failed error..please scroll and check for further error details in moni

Did to try to test ur Receiver SOAP using SOAP UI tool,,,is it reachable?

Regards,
Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Below is the error log,

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

Can you share the Request & Response (Input / Output) payloads for this.

Also the MM screenshots


Regards,

Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Below is my request

Below is my response payload structure

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

<getCRRecordResponse>

<getCRRecordResult>

<CompanyMain>

<CommercialEntityDetails>

<CommercialRegisteration>

<Number>1010232398</Number>

<ExpirationDate>

<HijriDate></HijriDate>

</ExpirationDate>

<IssueDate>

<HijriDate></HijriDate>

</IssueDate>

<City>

<CityString></CityString>

</City>

</CommercialRegisteration>

<EntityName>

<NameText></NameText>

</EntityName>

<EntityPostalAddress>

<UnstructuredAddress></UnstructuredAddress>

<AddressType></AddressType>

</EntityPostalAddress>

<EntityPhysicalAddress>

<UnstructuredAddress></UnstructuredAddress>

<AddressType></AddressType>

</EntityPhysicalAddress>

<EntityContactDetails>

<TelephoneNumber>

<TelephoneFullNumber></TelephoneFullNumber>

</TelephoneNumber>

<TelephoneNumber>

<TelephoneFullNumber></TelephoneFullNumber>

</TelephoneNumber>

<FaxNumber>

<TelephoneFullNumber></TelephoneFullNumber>

</FaxNumber>

<FaxNumber>

<TelephoneFullNumber></TelephoneFullNumber>

</FaxNumber>

<Telex></Telex>

</EntityContactDetails>

<EntityActivity>

<CommercialActivityUnstructured></CommercialActivityUnstructured>

<CommercialActivityUnstructured></CommercialActivityUnstructured>

<CommercialActivityUnstructured></CommercialActivityUnstructured>

<CommercialActivityUnstructured></CommercialActivityUnstructured>

</EntityActivity>

<EntityCapital>

<CommercialRegisterationStructuredCapital>

<CapitalInitialValue>0</CapitalInitialValue>

<CapitalAnnouncedValue>0</CapitalAnnouncedValue>

<CapitalPaidValue>250000000</CapitalPaidValue>

<CapitalCurrency>00</CapitalCurrency>

<ForeignPartnerPercentage>0</ForeignPartnerPercentage>

</CommercialRegisterationStructuredCapital>

</EntityCapital>

</CommercialEntityDetails>

<EntityLegalStructureType></EntityLegalStructureType>

<CompanyPartners>

<PersonFullName></PersonFullName>

</CompanyPartners>

<CompanyPartners>

<PersonFullName></PersonFullName>

</CompanyPartners>

<CompanyDetails>

<CompanyType></CompanyType>

<CompanyNationality>

<CountryNameText>

<CountryNameArabic></CountryNameArabic>

</CountryNameText>

</CompanyNationality>

</CompanyDetails>

</CompanyMain>

</getCRRecordResult>

</getCRRecordResponse>

I have developed the XSLT mapping for the response structure but when i test this mapping from OM it doesn't return any data as shown in the previous comments.

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

For the response Payload screenshot, can you try to test with this Payload in OM (Open the Response Payload xml file --> Right click --> View Source --> Copy the entire text msg into OM - Response Test Tab)..and check if you are able to get the Output for this RESPONSE step

Give a Screenshot for this too.

Regards,
Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Below is screenshot for same ,

same result of not getting any value in return.

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

Seems you are getting the Output tree structure but the values are missing in it..rite?

Can you paste the Response Payload here (as you get in View Source text File...) so that we can check.

Regards,
Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Below is the text response file ,

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

-<getCRRecordResponse> -<getCRRecordResult xmlns:ns0="Namespace"> -<CompanyMain> -<CommercialEntityDetails> -<CommercialRegisteration> <Number/> -<ExpirationDate> <HijriDate/> </ExpirationDate> -<IssueDate> <HijriDate/> </IssueDate> -<City> <CityString/> </City> </CommercialRegisteration> -<EntityName> <NameText/> </EntityName> -<EntityPostalAddress> <UnstructuredAddress/> <AddressType/> </EntityPostalAddress> -<EntityContactDetails> -<TelephoneNumber> <TelephoneFullNumber/> </TelephoneNumber> -<TelephoneNumber> <TelephoneFullNumber/> </TelephoneNumber> -<FaxNumber> <TelephoneFullNumber/> </FaxNumber> <Telex/> </EntityContactDetails> -<EntityActivity> <CommercialActivityUnstructured/> <CommercialActivityUnstructured/> <CommercialActivityUnstructured/> <CommercialActivityUnstructured/> </EntityActivity> -<EntityCapital> -<CommercialRegisterationStructuredCapital> <CapitalInitialValue/> <CapitalAnnouncedValue/> <CapitalPaidValue/> <CapitalCurrency/> <ForeignPartnerPercentage/> </CommercialRegisterationStructuredCapital> </EntityCapital> </CommercialEntityDetails> <EntityLegalStructureType/> -<CompanyPartners> <PersonFullName/> </CompanyPartners> -<CompanyPartners> <PersonFullName/> </CompanyPartners> -<CompanyDetails> <CompanyType/> -<CompanyNationality> -<CountryNameText> <CountryNameArabic/> </CountryNameText> </CompanyNationality> </CompanyDetails> </CompanyMain> </getCRRecordResult> </getCRRecordResponse>

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

This is the Output from your XSLT code in OM rite??

Not this Empty data file....I need the actual Response payload that you receive from the 3rd Party.

For the attached XML file that you posted abv...

For this Response XML file --> Open it --> Right Click --> View Source --> Opens text in Notepad --> Copy that text data here, so that I can ckh

Regards,
Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

Below is the 3rd party response,

<?xml version="1.0"?>

-<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> -<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> -<getCRRecordResponse xmlns="http://tempuri.org/"> -<getCRRecordResult> -<CompanyMain xmlns="http://namespace/MCI/CRManagementService/version/3.0"> -<CommercialEntityDetails xmlns="http:///MoCICommercialRecord/xml/schemas/version3.0"> -<CommercialRegisteration> <Number>1010232398</Number> -<ExpirationDate> <HijriDate xmlns="http:///CommonTypes/xml/schemas/version2.0">19-04-1436</HijriDate> </ExpirationDate> -<IssueDate> <HijriDate xmlns="http:///CommonTypes/xml/schemas/version2.0">19-04-1428</HijriDate> </IssueDate> -<City> <CityString xmlns="http:///CommonTypes/xml/schemas/version2.0">الرياض </CityString> </City> </CommercialRegisteration> -<EntityName language="AR"> <NameText xmlns="http:///CommercialEntityCommonTypes/xml/schemas/version2.0">شركه مملكه المعادن</NameText> </EntityName> -<EntityPostalAddress> <UnstructuredAddress xmlns="http:///CommonTypes/xml/schemas/version2.0">الرياض جنوب كبري الخليج بين شارع الضباب وشارع العليا العام</UnstructuredAddress> <AddressType xmlns="http:///CommonTypes/xml/schemas/version2.0">PhysicalLocation</AddressType> </EntityPostalAddress> -<EntityPhysicalAddress> <UnstructuredAddress xmlns="http:///CommonTypes/xml/schemas/version2.0">الرياض جنوب كبري الخليج بين شارع الضباب وشارع العليا العام</UnstructuredAddress> <AddressType xmlns="http:///CommonTypes/xml/schemas/version2.0">PhysicalLocation</AddressType> </EntityPhysicalAddress> -<EntityContactDetails> -<TelephoneNumber xmlns="http:///CommonTypes/xml/schemas/version2.0" telUse="Home" telMobile="Yes" telPreferred="No"> <TelephoneFullNumber>2198883</TelephoneFullNumber> </TelephoneNumber> -<TelephoneNumber xmlns="http:///CommonTypes/xml/schemas/version2.0" telUse="Home" telMobile="Yes" telPreferred="No"> <TelephoneFullNumber>0000000</TelephoneFullNumber> </TelephoneNumber> -<FaxNumber xmlns="http:///CommonTypes/xml/schemas/version2.0" telUse="Home" telMobile="Yes" telPreferred="No"> <TelephoneFullNumber>2197774</TelephoneFullNumber> </FaxNumber> -<FaxNumber xmlns="http:///CommonTypes/xml/schemas/version2.0" telUse="Home" telMobile="Yes" telPreferred="No"> <TelephoneFullNumber>0000000</TelephoneFullNumber> </FaxNumber> <Telex xmlns="http:///CommonTypes/xml/schemas/version2.0">000000/000000</Telex> </EntityContactDetails> -<EntityActivity> <CommercialActivityUnstructured xmlns="http:///CommercialEntityCommonTypes/xml/schemas/version2.0">تجاره الجمله والتجزئه في الالواح الجبسيه والزجاج بانواعه والخامات</CommercialActivityUnstructured> <CommercialActivityUnstructured xmlns="http:///CommercialEntityCommonTypes/xml/schemas/version2.0">الصناعية (الحجر الجيري والجبس والطين والبوزلان والسيلكا والالومينا</CommercialActivityUnstructured> <CommercialActivityUnstructured xmlns="http:///CommercialEntityCommonTypes/xml/schemas/version2.0">والحديد والبطحاء والرمل الابيض والاحمر والبوكسايد والمواد الصناعية</CommercialActivityUnstructured> <CommercialActivityUnstructured xmlns="http:///CommercialEntityCommonTypes/xml/schemas/version2.0">بانواعها .<<<<<<<<<</CommercialActivityUnstructured> <CommercialActivityUnstructured xmlns="http:///CommercialEntityCommonTypes/xml/schemas/version2.0"> </CommercialActivityUnstructured> </EntityActivity> -<EntityCapital> -<CommercialRegisterationStructuredCapital> <CapitalInitialValue>0</CapitalInitialValue> <CapitalAnnouncedValue>0</CapitalAnnouncedValue> <CapitalPaidValue>250000000</CapitalPaidValue> <CapitalCurrency>00</CapitalCurrency> <ForeignPartnerPercentage>0</ForeignPartnerPercentage> </CommercialRegisterationStructuredCapital> </EntityCapital> </CommercialEntityDetails> <EntityLegalStructureType xmlns="http:///MoCICommercialRecord/xml/schemas/version3.0">ذات مسئوليةمحدودة </EntityLegalStructureType> -<CompanyPartners language="AR" xmlns="http:///MoCICommercialRecord/xml/schemas/version3.0"> <PersonFullName xmlns="http:///PersonProfileCommonTypes/xml/schemas/version2.0">الامير فيصل بن يزيد بن عبدالله ال سعود</PersonFullName> </CompanyPartners> -<CompanyPartners language="AR" xmlns="http:///MoCICommercialRecord/xml/schemas/version3.0"> <PersonFullName xmlns="http:///PersonProfileCommonTypes/xml/schemas/version2.0">عبدالله منصور الشقير</PersonFullName> </CompanyPartners> -<CompanyDetails xmlns="http:///MoCICommercialRecord/xml/schemas/version3.0"> <CompanyType>ذات مسئوليةمحدودة </CompanyType> -<CompanyNationality> -<CountryNameText xmlns="http:///CommonTypes/xml/schemas/version2.0"> <CountryNameArabic>سعوديه </CountryNameArabic> </CountryNameText> </CompanyNationality> </CompanyDetails> </CompanyMain> </getCRRecordResult> </getCRRecordResponse> </s:Body> </s:Envelope>

Please let me know if there is any problem

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

I am not able to see the CDATA tags in your file above...

However I assuming that these CDATA is coming in the Node : getCRRecordResponse

Request you to change your XSL code as follows and Test in OM test Tab.

XSL code (In line 4, change it to ur Namespace)

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

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:ns0="http://www.testggg.org">

<xsl:template match="/">

<xsl:element name="getCRRecordResponse">

<xsl:value-of select="//*[local-name() = 'getCRRecordResponse']" disable-output-escaping="yes"/>

</xsl:element>

</xsl:template>

</xsl:stylesheet>

Regards,

Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

This trick worked.

Now i am getting the values in the message mapping test.

But still i am getting the error below while executing this interface from sproxy.

Regards,

Amit

Former Member
0 Kudos

Hi Amit

Please check the action name. Looks like there are some problem with the action name you have specified in the communication channel.

Thanks,

Indra

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

The trick worked but still the message is giving the SOAP fault error as below.

Even the message status is delivered it has the synchronous timeout error.

Kindly help me on this.

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

Great progress

Request you to increase the Channel Time out (as suggested below) and test if it works.

pg 17-19:

Hope it helps

Regards,
Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

I have increased the channel timeout period but still not working .

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

Seems connectivity issue. For the receiver 3rd Party please check:

1. Is the Port, firewall / network connection opened to connected to 3rd Party?

2. Are you able to launch the 3rd party URL in IE from your Client / PI network

3. Test with the same payload using 3rd party tool like SOAP UI and see the response. Use the tool from the Client domain/network (not from your local system).

4. Is the Ping Channel (for Receiver SOAP CC) working fine without any errors?

Regards,

Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar ,

Thanks for the guidance.

Tell me one thing for this above scenario we also have the fault message which is also in the cdata format. Then i also have to create the xslt mapping for it ??

I have the xsd format of it .

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

It depends on what & how the data is required by the 3rd Party.

Do you want to pass the CDAT as is? If yes then you dont need to add XSLT for Fault.

Incase you require the CDATA text to be converted to corresponding actual XML format, then you need to apply the XSLT mapping on fault as well.

Hope it helps

Regards,

Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar,

I will pass the CDATA fault message as is. Also my payload contains so many arabic data in return.

What needs to be added at the soap adapter for encoding ??

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

AFAIK - If the Arabic data is in CDATA, then you will not need to add any specific encoding.

Are you adding any specific Encoding for your request side message. You can add the same for Response message as well.

Test and check if any errors at your / 3rd party end.

Regards,
Azhar

Amitjadhav90
Explorer
0 Kudos

Hi Azhar ,

I have only single number as the input parameter for which i have not used any encoding but in the response i am getting some fields which will contain arabic data such as address etc. so whether for this data i need to to the encoding in the channel ??

Regards,

Amit

azharshaikh
Active Contributor
0 Kudos

Hi Amit,

UTF -8 should support it. Please refer following:

You can do a test run and check if any issues with Encoding.

Regards,
Azhar

Harish
Active Contributor
0 Kudos

Hi Amit,

did you check the below blog?

regards,

Harish

Amitjadhav90
Explorer
0 Kudos

Hi Harish,

First thanks for your quick reply !!!!

I have followed this document but i have not done java mapping before so it would be difficult for me to do.

Instead i have followed the XSLT mapping method as mentioned Mr. Azhar Shaikh next reply.