Put a value in CDATA and get him out of there - wso2

I have such a problem here: service with which I integrating, has a strange format.
takes the value:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" >
<soapenv:Header/>
<soapenv:Body>
<Operation>
<XmlStream>
<Name>GetPolicys</Name>
<XML><![CDATA[
<Arra>
<Ul>
<LastName>---</LastName>
<FirstName>---</FirstName>
<FatherName>---</FatherName>
<Birthday>---</Birthday>
</Ul>
</Array>]]>
</XML>
</XmlStream>
</Operation>
</soapenv:Body>
</soapenv:Envelope>
and returns
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<OperationResponse>
<OperationResult>
<ResultName>GetPolicys</ResultName>
<XML><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<Array>
<Ul>
<LastName>----</LastName>
<FirstName>----</FirstName>
<FatherName>---</FatherName>
<Birthday>--</Birthday>
<PolicyList>
----
</PolicyList>
</Ul>
</Array>]]>
</XML>
</OperationResult>
</OperationResponse>
</s:Body>
</s:Envelope>
create a nested message I got. As it wrapped in a CDATA? How to get it from CDATA in the preparation?

You can use XSLT to pick out from CDATA..

Related

SOAP namespace change axis

I want to host a web-service which will return a response of
<soapenv:Envelope 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">
<soapenv:Body>
<QcB2BQNBPaymentIntegrationBalUpdatePaymentPostingResponse xmlns="http://tempuri.org">
<response xmlns:b="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<b:string>QCP-0031312;158155421123</b:string>
</response>
</QcB2BQNBPaymentIntegrationBalUpdatePaymentPostingResponse>
</soapenv:Body>
</soapenv:Envelope>
but I am getting the response as
<soapenv:Envelope 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">
<soapenv:Body>
<QcB2BQNBPaymentIntegrationBalUpdatePaymentPostingResponse xmlns="http://tempuri.org">
<response >
<ns1:string xmlns:ns1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">QCP-0031312;158155421123</ns1:string>
</response>
</QcB2BQNBPaymentIntegrationBalUpdatePaymentPostingResponse>
</soapenv:Body>
</soapenv:Envelope>
I want to get the former response. please share some insight.
note: I've generated the java bean skeleton using axis

How to transfor soap fault message in xslt transformation

how to create xslt which transforms the response message to a soap fault message.please refer the Attached the Input and what i expected Output,xslt Result after xslt transformation.
This is my xml
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<soapenv:Fault>
<soapenv:Code>
<soapenv:Value>soapenv:Sender</soapenv:Value>
</soapenv:Code>
<soapenv:Reason>
<soapenv:Text xml:lang="en">User NotFound</soapenv:Text>
</soapenv:Reason>
<soapenv:Detail>
<axis2ns4:sdpFault xmlns:axis2ns4="http://testservice.com/uat/testservice">
<axis2ns4:resultNameCode>2</axis2ns4:resultNameCode>
<axis2ns4:resultNameType>GH</axis2ns4:resultNameType>
</axis2ns4:sdpFault>
</soapenv:Detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Expecte result
set this message <soapenv:Text xml:lang="en">User NotFound</soapenv:Text>
<ns1:UserDescription>User NotFound</ns1:UserDescription>

Building SOAP request from WSDL

I need to execute a SOAP request to an external server. I have never worked with SOAP before, but I know the basics of REST.
I've been given this following WSDL file and this example query:
<Messages>
<Version Ds_Version="0.0">
<Message>
<Detail>
<Ds_MerchantCode>999008881</Ds_MerchantCode>
<Ds_Terminal>1</Ds_Terminal>
<Ds_Order>5799L</Ds_Order>
<Ds_TransactionType>3</Ds_TransactionType>
</Detail>
</Message>
</Version>
<Signature>UfECD0KD9Wwo1iqY6PYZoJxw8KwMUz8m18bgLyH3BCI=</Signature>
<SignatureVersion>HMAC_SHA256_V1</SignatureVersion>
</Messages>
I'm using Postman in order to test the API. Following some instructions I found on the internet, I added a Content-Type HTTP header with value text/xml and the SOAPAction HTTP header with value consultaOperaciones as found in the WSDL file.
I've set this body:
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope/"
soap:encodingStyle="http://www.w3.org/2003/05/soap-encoding">
<soap:Body xmlns:m="http://webservices.apl02.redsys.es">
<m:consultaOperacionesRequest>
<Messages>
<Version Ds_Version="0.0">
<Message>
<Transaction>
<Ds_MerchantCode>999008881</Ds_MerchantCode>
<Ds_Terminal>1</Ds_Terminal>
<Ds_Order>5799L</Ds_Order>
<Ds_TransactionType>3</Ds_TransactionType>
</Transaction>
</Message>
</Version>
<Signature>1KoxTgTakbTprzJ2N/e9JJ8yw/C3QzeNafbUMCNGSFM=</Signature>
<SignatureVersion>HMAC_SHA256_V1</SignatureVersion>
</Messages>
</m:consultaOperacionesRequest>
</soap:Body>
</soap:Envelope>
However, when I send the request I receive the following error message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring>Internal Error</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
It's a generic SOAP error message, therefore I think that the problem has to be related to the codification instead of the external service.
Thanks in advance.
In the WSDL file you will see that the XML should be sent as a string:
<element name="consultaOperaciones">
<complexType>
<sequence>
<element name="cadenaXML" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</element>
Hence the XML sent should be:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.apl02.redsys.es">
<soapenv:Header/>
<soapenv:Body>
<web:consultaOperaciones>
<cadenaXML><![CDATA[
<Messages>
<Version Ds_Version="0.0">
<Message>
<Detail>
<Ds_MerchantCode>999008881</Ds_MerchantCode>
<Ds_Terminal>1</Ds_Terminal>
<Ds_Order>5799L</Ds_Order>
<Ds_TransactionType>3</Ds_TransactionType>
</Detail>
</Message>
</Version>
<Signature>UfECD0KD9Wwo1iqY6PYZoJxw8KwMUz8m18bgLyH3BCI=</Signature>
<SignatureVersion>HMAC_SHA256_V1</SignatureVersion>
</Messages>
]]>
</cadenaXML>
</web:consultaOperaciones>
</soapenv:Body>
</soapenv:Envelope>
Note that we are using CDATA because as mentioned the XML message should be sent as a string based on the WSDL. I have tried running it and got the response:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<p259:consultaOperacionesResponse xmlns:p259="http://webservices.apl02.redsys.es">
<consultaOperacionesReturn><![CDATA[<Messages><Version Ds_Version="0.0"><Message><ErrorMsg><Ds_ErrorCode>XML0023</Ds_ErrorCode></ErrorMsg></Message></Version></Messages>]]></consultaOperacionesReturn>
</p259:consultaOperacionesResponse>
</soapenv:Body>
</soapenv:Envelope>
This means that your message is being parsed now because there are no server errors and a consultaOperacionesResponse is being sent which looks legit. The error seems to be related to the data being sent but in general the API is working fine as expected.

removing XML tags using XSLT

I have an incoming SOAP message as given below. This incoming SOAP message contains an embedded XML declaration (<?xml version="1.0" encoding="UTF-8"?>) in the <ns1:disXML> element:
<soapenv:Envelope 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">
<soapenv:Body>
<ns1:process xmlns:ns1="http://example.com">
<ns1:disXML><?xml version="1.0" encoding="UTF-8"?>
<TP memberFirstName="Tom"></TP>
</ns1:disXML>
</ns1:process>
</soapenv:Body>
</soapenv:Envelope>
How can I remove that embedded declaration?

SharePoint Web Services Team Discussion and Replies

I am trying to get a discussion with all it's replies from the sharepoint web services but only seem to be able to get the root message and not any of the replies. Below is the soap XML. What am I missing?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
<soapenv:Header/>
<soapenv:Body>
<soap:GetListItems>
<!--Optional:-->
<soap:listName>Team Discussion</soap:listName>
<soap:viewFields>
<ViewFields>
<FieldRef Name='Title'/>
<FieldRef Name='ItemChildCount'/>
<FieldRef Name='Body'/>
</ViewFields>
</soap:viewFields>
<soap:queryOptions>
<QueryOptions>
<Folder>
"http://Lists/Team Discussion/Bite Me"
</Folder>
</QueryOptions>
</soap:queryOptions>
</soap:GetListItems>
</soapenv:Body>
</soapenv:Envelope>
The reply is:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<GetListItemsResult>
<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data ItemCount="2">
<z:row ows_Title="Hello" ows_ItemChildCount="3;#1" ows_Body="<div class="ExternalClass7B4989B3DC264716AD81B9CE55FD38FA"><p>​The text of the message</p></div>" ows_MetaInfo="3;#" ows__ModerationStatus="0" ows__Level="1" ows_ID="3" ows_UniqueId="3;#{6AF6D7DA-0D87-45EC-B002-AA0D153B6286}" ows_owshiddenversion="1" ows_FSObjType="3;#1" ows_Created="2012-01-11 12:21:26" ows_PermMask="0x7fffffffffffffff" ows_Modified="2012-01-11 12:21:26" ows_FileRef="3;#Lists/Team Discussion/Hello"/>
<z:row ows_Title="Bite Me" ows_ItemChildCount="1;#1" ows_Body="<div class="ExternalClass76A3DB4368714038B6B75DB0D807240B"><p>​Really?</p></div>" ows_MetaInfo="1;#" ows__ModerationStatus="0" ows__Level="1" ows_ID="1" ows_UniqueId="1;#{336518DC-B806-4DFB-9483-AB8DBB6258B6}" ows_owshiddenversion="1" ows_FSObjType="1;#1" ows_Created="2012-01-09 14:16:29" ows_PermMask="0x7fffffffffffffff" ows_Modified="2012-01-09 14:16:29" ows_FileRef="1;#Lists/Team Discussion/Bite Me"/>
</rs:data>
</listitems>
</GetListItemsResult>
</GetListItemsResponse>
</soap:Body>
</soap:Envelope>
EDIT: Each of the above posts should also have a reply.
I eventually found the magic query. It seems sub folders are only returned when you add a query based on date, i.e. this soap request works.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/">
<soapenv:Header/>
<soapenv:Body>
<soap:GetListItems>
<!--Optional:-->
<soap:listName>969E0130-5727-4E7D-A908-B3A5BC447E24</soap:listName>
<soap:viewFields>
<ViewFields>
<FieldRef Name='Title'/>
<FieldRef Name='Created'/>
<FieldRef Name='Author'/>
<FieldRef Name='Body'/>
</ViewFields>
</soap:viewFields>
<soap:query>
<Query>
<Where>
<Geq>
<FieldRef Name='Created' />
<Value Type='DateTime'>2010-08-20T14:00:00</Value>
</Geq>
</Where>
<OrderBy><FieldRef Name='ThreadIndex' Ascending='true' /></OrderBy>
</Query>
</soap:query>
<soap:queryOptions>
<QueryOptions>
<ViewAttributes Scope="RecursiveAll" IncludeRootFolder="False" />
</QueryOptions>
</soap:queryOptions>
</soap:GetListItems>
</soapenv:Body>
</soapenv:Envelope>
The essential parts are the query element with the date and the query option to specify the query is recursive.
imho shouldn't need the query as it should return everything by default.
The folder option listed in the other article didn't make any difference for me.
Have you checked out this article:
How to access SharePoint's Discussion Board using Web Services
http://geekswithblogs.net/kobush/archive/2007/03/12/108545.aspx