transformRequest

Dear Isomorphic. I am totally new to SmartClient, so please forgive possibly trivial question.

This said, here’s my issue:

Here’s the request that is being generated by SmartClient (6.5.1) from the WSDL:

<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:Header></soap:Header>
<soap:Body
xmlns:ns0=“http://abc123.com/nameSpace1”
xmlns:ns1=“http://abc123.com/nameSpace2”>
<ns0:complexElement1>
<A1_REQT>
<ns0:A1SoapRequest>
<ns1:appId>APP1</ns1:appId>
<ns1:clientId>app</ns1:clientId>
</ns0:A1SoapRequest>
<PROF_ID>6</PROF_ID>
<FILTER_CRITERIA>
<FILTER_LIST>
<FILTER>
<FILTER_CODE>BP_CLSFN</FILTER_CODE>
<VALUE_LIST>
<VALUE>PRES</VALUE>
</VALUE_LIST>
</FILTER>
</FILTER_LIST>
</FILTER_CRITERIA>
<SEARCH_CRITERIA>
<PERS_SRCH_PARM>
<LAST_NM>Doe</LAST_NM>
</PERS_SRCH_PARM>
<GEO_SRCH_PARM/>
<ST_LIC_SRCH_PARM/>
</SEARCH_CRITERIA>
</A1_REQT>
</ns0:complexElement1>
</soap:Body>
</soap:Envelope>

I am wondering if there is any way to modify this XML through transformRequest. I need the request to be as follows:

<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:Header></soap:Header>
<soap:Body
xmlns:ns0=“http://abc123.com/nameSpace1”
xmlns:ns1=“http://abc123.com/nameSpace2”>
<ns0:complexElement1>
<A1_REQT>
<ns1:appId>APP1</ns1:appId>
<ns1:clientId>app</ns1:clientId>
<PROF_ID>6</PROF_ID>
<FILTER_CRITERIA>
<FILTER_LIST>
<FILTER>
<FILTER_CODE>BP_CLSFN</FILTER_CODE>
<VALUE_LIST>
<VALUE>PRES</VALUE>
</VALUE_LIST>
</FILTER>
</FILTER_LIST>
</FILTER_CRITERIA>
<SEARCH_CRITERIA>
<PERS_SRCH_PARM>
<LAST_NM>Doe</LAST_NM>
</PERS_SRCH_PARM>
<GEO_SRCH_PARM/>
<ST_LIC_SRCH_PARM/>
</SEARCH_CRITERIA>
</A1_REQT>
</ns0:complexElement1>
</soap:Body>
</soap:Envelope>

So, basically I need to remove two lines from it (<ns0:A1SoapRequest> and </ns0:A1SoapRequest>). Can it be done in any way ? Please help!!!

Regardless of where you do it, you want to remove the data that is causing those elements to be formed, not try to modify the final XML. You could do so in transformRequest(), at at some earlier phase (eg before the call fetchData(), callOperation() or wherever you triggered this request.

Removing the

 <ns0:A1SoapRequest></ns0:A1SoapRequest>

using transformRequest would remove all the inner elements (appId and clientId), wouldn’t it ? I need those elements there and I need them qualified as belonging to ns1: schema. If I remove this little envelope from the original WSDL and just leave the simple elements of appId and clientId SmartClient interprets them as belonging to ns0: schema.

So again, is there anything I can do to just custom tailor the XML string using transformRequest ? Thank you in advance.

Again, focus on the data as a means of changing the XML, not the XML itself.

You haven’t shared anything about how you’re putting the data together, but basically, you seem to be passing a property “A1SoapRequest” that contains two properties appId and clientId, and you need to eliminate this extra level of structure in the data, then the XML will be formed how you want.