I am trying to generate the following xml output:
<OrderDataUpdate xmlns=”http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25”>
<TetheringType>IE Tethering</TetheringType>
</OrderDataUpdate>
But instead I get this(note the text content for TetheringType is not populated).
<OrderDataUpdate xmlns="http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25">
<TetheringType/>
</OrderDataUpdate>
My input XML:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<ser:serviceLookUpResponse
xmlns:ser="http://xmlns.oracle.com/communications/inventory/webservice/service">
<com:requestContext xsi:nil="true"
xmlns:com="http://xmlns.oracle.com/communications/inventory/webservice/common"/>
<com:messages xmlns:com="http://xmlns.oracle.com/communications/inventory/webservice/common"
>Success</com:messages>
<service>
<id>12021409</id>
<name>1</name>
<description xsi:nil="true"/>
<state>in service</state>
<startDate>2013-11-06T00:13:02.000-06:00</startDate>
<specification>
<name>HSPA Wireless Service</name>
<entityType>Service</entityType>
<description xsi:nil="true"/>
<startDate>2010-05-13T00:00:01.000-05:00</startDate>
<endDate xsi:nil="true"/>
</specification>
<parties>
<id>1-3BQJ7K</id>
<name>MTSC NETWORK SRV WIRELESS-CELLULAR</name>
<description xsi:nil="true"/>
</parties>
<configurations>
<version>31</version>
<previousVersion>30</previousVersion>
<id>Se_12021409_31</id>
<name>Se_12021409_31</name>
<description xsi:nil="true"/>
<state>completed</state>
<startDate>2015-01-21T15:03:52.000-06:00</startDate>
<endDate xsi:nil="true"/>
<configurationItems>
<name>Entitlement</name>
<index>0</index>
<resourceAssignment>
<state>assigned</state>
<resource>
<id>Tethering</id>
<name xsi:nil="true"/>
<description>Tethering Entitlement</description>
<specification>
<name>Entitlement</name>
<entityType>Custom Network Address</entityType>
<description xsi:nil="true"/>
<startDate>2015-01-15T00:00:01.000-06:00</startDate>
<endDate xsi:nil="true"/>
</specification>
</resource>
</resourceAssignment>
<resourceReference xsi:nil="true"/>
<characteristics>
<name>Tethering Type</name>
<value>IE Tethering</value>
</characteristics>
</configurationItems>
</configurations>
</service>
</ser:serviceLookUpResponse>
</soapenv:Body>
</soapenv:Envelope>
Xquery:
declare namespace soap = "http://schemas.xmlsoap.org/soap/envelope/";
declare namespace ser = "http://xmlns.oracle.com/communications/inventory/webservice/service";
declare namespace oms = "urn:com:metasolv:oms:xmlapi:1";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method "xml";
declare option output:indent "yes";
declare function local:generateUpdate($uimResponse as element()*) as element()
{
let $update :=
<OrderDataUpdate xmlns="http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25">
<TetheringType>{ $uimResponse//characteristics[name='Tethering Type']/value/text() }</TetheringType>
</OrderDataUpdate>
return
$update
};
let $uimResponse := fn:root(.)/soap:Envelope/soap:Body/ser:serviceLookUpResponse
let $mdn := $uimResponse//configurationItems[name = 'MDN']/resourceAssignment/resource/name/text()
let $output := local:generateUpdate($uimResponse)
return
(
$output
)
If I modify the function local:generateUpdate to remove xmlns="http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25", then text content of TetheringType gets populated in the generated output xml which appears something like below:
<OrderDataUpdate>
<TetheringType>IE Tethering</TetheringType>
</Add>
</OrderDataUpdate>
What am I doing wrong? Can someone explain to me why is it that on adding xmlns=”http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25” to the OrderDataUpdate element, the text content of xml nodes are not populated in the xml output. I need the <OrderDataUpdate> to be associated with the namespace "http://www.metasolv.com/OMS/OrderDataUpdate/2002/10/25"
Any help would be appreciated.
Thanks in advance.