Soap to Rest API array is not converted.

Not applicable

For example I have an array looks like below:

<ser:slots>

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

<arr:short>105</arr:short>

<arr:short>106</arr:short>

<arr:short>107</arr:short>

<arr:short>108</arr:short>

</ser:slots>

but in the extract policy, I couldnt find one entry for this field and in the build SOAP policy shows some thing as below:

<slots/>

Please can anyone suggest me the workaround.

0 5 475
5 REPLIES 5

Former Community Member
Not applicable

Hi @raghavnaga.prakasam it could potentially be a namespace issue. Can you post your Extract Variable & the Build SOAP policies here?

Not applicable

Bild SOAP:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <AssignMessage async="false" continueOnError="true" enabled="true" name="UnlockSlots-build-soap"> <DisplayName>UnlockSlots Build SOAP</DisplayName> <Add> <Headers> <Header name="SOAPAction">http://www.XXXX.com/Services/XXXXCalendar/UnlockSlots</Header> </Headers> </Add> <Set> <Headers> <Header name="Content-Type">text/xml; charset=utf-8</Header> </Headers> <Payload contentType="text/xml"> <soapenv:Envelope xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:i0="http://tempuri.org/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tns="http://www.xxxxxxxx.com/Services" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract"> <soapenv:Body> <tns:UnlockSlots> <!--Optional--> <tns:apiSessionId>{apiSessionId}</tns:apiSessionId> <!--Optional--> <tns:calendarId>{calendarId}</tns:calendarId> <!--Optional--> <tns:userId>{userId}</tns:userId> <!--Optional--> <tns:slots/> </tns:UnlockSlots> </soapenv:Body> </soapenv:Envelope> </Payload> <Verb>POST</Verb> </Set> <AssignVariable> <Name>forward.target.url</Name> <Value>https://xxxx.xxxx.com/XXXX_57_API_UAT/Services/xxxx.svc</Value> </AssignVariable> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> <AssignTo createNew="false" transport="http" type="request"/> </AssignMessage>

Extract Variables:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ExtractVariables async="false" continueOnError="true" enabled="true" name="UnlockSlots-extract-query-param"> <DisplayName>UnlockSlots Extract Query Param</DisplayName> <QueryParam name="apiSessionId"> <Pattern ignoreCase="true">{apiSessionId}</Pattern> </QueryParam> <QueryParam name="calendarId"> <Pattern ignoreCase="true">{calendarId}</Pattern> </QueryParam> <QueryParam name="userId"> <Pattern ignoreCase="true">{userId}</Pattern> </QueryParam> <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables> </ExtractVariables>

Not applicable

Anyways I had placed a JS file and constructed the whole SOAP xml behind with the arrays.But it would be good if apigee does that wile the conversion process.A good to have stuff.

Former Community Member
Not applicable

Hi @raghavnaga.prakasam I am a little confused, in your ExtractVariable policy above you are extracting information from the query parameters. I am not sure how that relates to your question of extracting information from a XML payload. Please review the ExtractVariable policy documentation, click on the XML tab. Looks like from what you may be looking to doing the following fragment may work:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-Variables-1">
    <DisplayName>Extract Variables-1</DisplayName>
    <Source>request</Source>
    <XMLPayload>
        <Namespaces>
            <Namespace prefix="tns">http://www.xxxxxxxx.com/Services</Namespace>
            <Namespace prefix="soapenv">http://schemas.xmlsoap.org/soap/envelope/</Namespace>
        </Namespaces>
        <Variable name="apiSessionId" type="string">
            <XPath>/soapenv:Envelope/soapenv:Body/tns:UnlockSlots/tns:apiSessionId</XPath>
        </Variable>
        <Variable name="calendarId" type="string">
            <XPath>/soapenv:Envelope/soapenv:Body/tns:UnlockSlots/tns:calendarId</XPath>
        </Variable>
        <Variable name="userId" type="string">
            <XPath>/soapenv:Envelope/soapenv:Body/tns:UnlockSlots/tns:userId</XPath>
        </Variable>
    </XMLPayload>
</ExtractVariables>

Not applicable

Hi @Prithpal Bhogill , payload is a json since I have used apigees REST-SOAP-REST conversion.