Please help me resolve this issue.
I have written post method web service program in rpgle. I will receive xml input for purchase order. If process success means , i should return Acknowledgement as a xml response. Here my problem is, i have declared item data structure as a array with dim(9). so if item blank also , web service generating xml for blanks items . i don't know how to control.
is there any other way to control in program or in web service deployment ?. please help
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<WBSRVGET5Result>
<BROKERACKNOWLEDGEMENT>
<IDENTIFICATION>
<DATE>2017-06-12T08:33:25</DATE>
<FROMORG_ID>xxxxx</FROMORG_ID>
<MESSAGEPROTOCOL_ID>PurchaseOrder</MESSAGEPROTOCOL_ID>
<SENDERORG_ID>xxxxx</SENDERORG_ID>
<TOORG_ID>Vendor Name here</TOORG_ID>
</IDENTIFICATION>
<ORDERHEADER>
<ACKNOWLEDGEMENTTYPE></ACKNOWLEDGEMENTTYPE>
<BACKORDEROK>0</BACKORDEROK>
<BROKERCREATEDDATE>2017-06-09</BROKERCREATEDDATE>
<BROKERORDERID>09442000</BROKERORDERID>
<CUSTOMERPONUMBER>997545</CUSTOMERPONUMBER>
<FREIGHTPAYMENTMETHOD>P</FREIGHTPAYMENTMETHOD>
<OVERALLPROCESSSTATUS>P</OVERALLPROCESSSTATUS>
<REQUESTEDSHIPDATE>2017-08-21</REQUESTEDSHIPDATE>
<SHIPMETHOD>90</SHIPMETHOD>
<SHIPPINGINSTRUCTIONS></SHIPPINGINSTRUCTIONS>
<SUBSTITUTIONOK>0</SUBSTITUTIONOK>
<VENDORNUMBER>0090000484</VENDORNUMBER>
<VENDORORDERID></VENDORORDERID>
<SOLDTO>
<SOLDTOADDRESS1>PO BOX 808</SOLDTOADDRESS1>
<SOLDTOADDRESS2></SOLDTOADDRESS2>
<SOLDTOCITY>WABASSO</SOLDTOCITY>
<SOLDTOCONTACTNAME>SHIR BARTON</SOLDTOCONTACTNAME>
<SOLDTOCOUNTRY>(77</SOLDTOCOUNTRY>
<SOLDTOEMAIL></SOLDTOEMAIL>
<SOLDTOFAX>(772)589-5019</SOLDTOFAX>
<SOLDTONAME>CITY DSP</SOLDTONAME>
<SOLDTOPHONE>(772)589-5835</SOLDTOPHONE>
<SOLDTOSTATE>FL</SOLDTOSTATE>
<SOLDTOZIP>32970</SOLDTOZIP>
</SOLDTO>
<SHIPTO>
<BROKERSHIPTONUMBER>66981</BROKERSHIPTONUMBER>
<SHIPTOADDRESS1>9080 N US 1</SHIPTOADDRESS1>
<SHIPTOADDRESS2></SHIPTOADDRESS2>
<SHIPTOCITY>WABASSO</SHIPTOCITY>
<SHIPTOCONTACTNAME>ROCKURS LDSP</SHIPTOCONTACTNAME>
<SHIPTOCOUNTRY>US</SHIPTOCOUNTRY>
<SHIPTOEMAIL>grower.com</SHIPTOEMAIL>
<SHIPTOFAX>(772)589-5019</SHIPTOFAX>
<SHIPTONAME>ROCK CITY NURS LDSP</SHIPTONAME>
<SHIPTOPHONE>(772)589-5835</SHIPTOPHONE>
<SHIPTOSTATE>FL</SHIPTOSTATE>
<SHIPTOZIP>32970</SHIPTOZIP>
</SHIPTO>
</ORDERHEADER>
<ORDERDETAILS>
<ITEM>
<BROKERLINEITEMNO>10</BROKERLINEITEMNO>
<BROKERMATERIALNO>4091391972084</BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY>168.0</CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION>EVOLVU BLUED 84/84 Tray</MATERIALDESCRIPTION>
<ORDERQTY>168.0</ORDERQTY>
<SCHEDULEDSHIPDATE>2017-08-21</SCHEDULEDSHIPDATE>
<VENDORMATERIALNO>4091391972084</VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO>11</BROKERLINEITEMNO>
<BROKERMATERIALNO>4091391972083</BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY>128.0</CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION>EVOLD 84/84 Tray</MATERIALDESCRIPTION>
<ORDERQTY>128.0</ORDERQTY>
<SCHEDULEDSHIPDATE>2017-08-21</SCHEDULEDSHIPDATE>
<VENDORMATERIALNO>4091391972084</VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO>12</BROKERLINEITEMNO>
<BROKERMATERIALNO>4091391972085</BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY>198.0</CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION>EVOIND 84/84 Tray</MATERIALDESCRIPTION>
<ORDERQTY>198.0</ORDERQTY>
<SCHEDULEDSHIPDATE>2017-09-15</SCHEDULEDSHIPDATE>
<VENDORMATERIALNO>4091391972084</VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO></BROKERLINEITEMNO>
<BROKERMATERIALNO></BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY></CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION></MATERIALDESCRIPTION>
<ORDERQTY></ORDERQTY>
<SCHEDULEDSHIPDATE></SCHEDULEDSHIPDATE>
<VENDORMATERIALNO></VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO></BROKERLINEITEMNO>
<BROKERMATERIALNO></BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY></CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION></MATERIALDESCRIPTION>
<ORDERQTY></ORDERQTY>
<SCHEDULEDSHIPDATE></SCHEDULEDSHIPDATE>
<VENDORMATERIALNO></VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO></BROKERLINEITEMNO>
<BROKERMATERIALNO></BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY></CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION></MATERIALDESCRIPTION>
<ORDERQTY></ORDERQTY>
<SCHEDULEDSHIPDATE></SCHEDULEDSHIPDATE>
<VENDORMATERIALNO></VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO></BROKERLINEITEMNO>
<BROKERMATERIALNO></BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY></CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION></MATERIALDESCRIPTION>
<ORDERQTY></ORDERQTY>
<SCHEDULEDSHIPDATE></SCHEDULEDSHIPDATE>
<VENDORMATERIALNO></VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO></BROKERLINEITEMNO>
<BROKERMATERIALNO></BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY></CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION></MATERIALDESCRIPTION>
<ORDERQTY></ORDERQTY>
<SCHEDULEDSHIPDATE></SCHEDULEDSHIPDATE>
<VENDORMATERIALNO></VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO></BROKERLINEITEMNO>
<BROKERMATERIALNO></BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY></CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION></MATERIALDESCRIPTION>
<ORDERQTY></ORDERQTY>
<SCHEDULEDSHIPDATE></SCHEDULEDSHIPDATE>
<VENDORMATERIALNO></VENDORMATERIALNO>
</ITEM>
<ITEM>
<BROKERLINEITEMNO></BROKERLINEITEMNO>
<BROKERMATERIALNO></BROKERMATERIALNO>
<COMMITTEDINVPONO></COMMITTEDINVPONO>
<CONFIRMEDQTY></CONFIRMEDQTY>
<LINEITEMCOMM></LINEITEMCOMM>
<LINEITEMSTATUS></LINEITEMSTATUS>
<MATERIALDESCRIPTION></MATERIALDESCRIPTION>
<ORDERQTY></ORDERQTY>
<SCHEDULEDSHIPDATE></SCHEDULEDSHIPDATE>
<VENDORMATERIALNO></VENDORMATERIALNO>
</ITEM>
</ORDERDETAILS>
</BROKERACKNOWLEDGEMENT>
</WBSRVGET5Result>
If it's a IAS - you should add extra out parameters (INT) names as a you table + '_LENGTH'
In your case it;s somethink like this:
dcl-ds ORDERDETAILS;
ITEM_LENGTH int(10);
ITEM likeds(XYZ) dim(9);
end-ds;
ITEM_LENGTH must be before ITEM definition :)
You don't see this variable in response of web service - but you see only ITEM_LENGTH element's on response :)
Related
Hi I need to convert the following input xml to the below mentioned output xml using xsl 2.0 version. I'm pretty new to xslt and I've tried using apply-templates and for-each-group to get a distinct collection of clients.
Input:
<?xml version="1.0" encoding="utf-8" ?>
<ITEM>
<allCounselling>
<ITEM>
<allAttendingPeople>
<ITEM>
<PersonKey>1</PersonKey>
</ITEM>
</allAttendingPeople>
<allSessions>
<ITEM>
<KEY></KEY>
<DATE>12 Dec 2014</DATE>
<allAttendedPeople>
<ITEM>
<PersonKey>1</PersonKey>
</ITEM>
<ITEM>
<PersonKey>2</PersonKey>
</ITEM>
</allAttendedPeople>
</ITEM>
</allSessions>
</ITEM>
</allCounselling>
</ITEM>
Required Output is
<Clients>
<Client>
<ClientId>1</ClientId>
</Client>
<Client>
<ClientId>2</ClientId>
</Client>
</Clients>
The PersonKey value is the ClientId and should be a distinct collection.
The other difficult part is that I have to filter the sessions also. If the session Item is within a given date range, then I should only out put the persons within that allAttendedPeople collection of those filtered sessions and then I have to traverse up to get the counselling item which contains those sessions and out put all attending people...I know it's pretty hectic :'(
Please help!
I have the xml structure xml like that:
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">
<channel>
<item>
<comments>http://www.rtl.fr/actu/politique/laurent-gerra-imitant-nicolas-sarkozy-il-faut-barrer-la-
<slash:comments>0</slash:comments>
</item>
</channel>
</rss>
How can I get text in <slash:comments> tag.
I already try(Swift version):
elementItem.child("comments",inNamespace: "slash").
But it don't work.
As stated here, RaptureXML deletes namespaces, so you can access your content via
elementItem.child("comments")
How to get data from this kind of rss on ios ?
how to get data inside the <![CDATA[ ?
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Title 1</title>
<link>http://link1.com</link>
<description>Description 1</description>
<language>en-us</language>
<pubDate>Wed, 27 Feb 2013 12:38:54 EST</pubDate>
<lastBuildDate>Wed, 27 Feb 2013 12:38:54 EST</lastBuildDate>
<webMaster>webmaster#site.com (Hunny Bunny)</webMaster>
<item>
<title>item 1 title</title>
<link>http://item1 link</link>
<description><![CDATA[
<h2>My Item 2</h2>
<img src="http://itemi.com/image1.png" align="left"/>
]]></description>
<pubDate>Wed, 27 Feb 2013 12:10:40 EST</pubDate>
</item>
<item>
<title>item 2 title</title>
<link>http://item2.com/link</link>
<description><![CDATA[
<h2>My Item 1</h2>
<img src="http://itemi.com/image1.png" align="left"/>
]]></description>
<pubDate>Wed, 27 Feb 2013 12:10:40 EST</pubDate>
</item>
</channel>
</rss>
An option would be to use the NSXMLParser. I've used it with great success when parsing my RSS as well as ATOM feeds.
To examine information within <![CDATA[...]]>, you'll want to implement the following method of the NSXMLParserDelegate protocol:
- (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock
Here's a terrific tutorial to get you started: Parsing XML data with NSXMLParser
I am working on a custom portal to VMware vCenter through the VMware Orchestrator API. I am using savon to query the SOAP API (WSDL) of Orchestrator and have that returning valid data... specifically an XML containing all the Virtual Machines.
What is the best/easiest way to capture the response into a Rails Model? The XML structure of the response is below...
<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>
<findResponse xmlns="http://webservice.vso.dunes.ch">
<findReturn>
<totalCount>4</totalCount>
<elements>
<item>
<type>VC:VirtualMachine</type>
<id>vc.demo.local/vm-37</id>
<properties>
<item>
<name>displayName</name>
<value>FreeNAS</value>
</item>
<item>
<name>isTemplate</name>
<value>false</value>
</item>
<item>
<name>name</name>
<value>FreeNAS</value>
</item>
<item>
<name>connectionState</name>
<value>connected</value>
</item>
<item>
<name>state</name>
<value>poweredOff</value>
</item>
<item>
<name>vimHost</name>
<value>https://vc.demo.local:443/sdk</value>
</item>
<item>
<name>id</name>
<value>vm-37</value>
</item>
<item>
<name>dunesId</name>
<value>vc.demo.local/vm-37</value>
</item>
</properties>
<dunesUri>dunes://service.dunes.ch/CustomSDKObject?id='vc.demo.local/vm-37'&dunesName='VC:VirtualMachine'</dunesUri>
</item>
<item>
...
</item>
</elements>
</findReturn>
</findResponse>
</soapenv:Body>
</soapenv:Envelope>
You could pick out the few key attributes that you may want to query for (name, id, type) and then just store the rest of the XML as a clob or varchar or as a native XML type if your db supports it. Them you can read other values out in code when you need to.
I use the nokogiri gem to parse xml. With nokogiri you can call an xpath to get all elements with a certain parent tag. For example using your xml:
your_Model = Your_Model.new
docs = Nokogiri::XML(your.xml)
your_Model = docs.xpath('//item').map do |i|
{
#here you would need to map the objects of the xml to your model attributes so if your attributes were called, itemname, and itemvalue the code would be.
itemname => i.xpath('name').inner_text,
itemvalue => i.xpath('value').inner_text
}
your_Model.save!
Make sure you require the Nokogiri gem if you decide to go this route.
Hope it helps
How to do String replace method for a variable wish storing the data with including the xml tags. With out storing in a variable the string replacing method is working but my result is stored in a variable. Every time its keep on updated. That's why the string replacing method must be applied for that variable.
Sample strings:
<item>
<Matkl>001</Matkl>
<Text>Metal processing</Text>
</item>
<item>
<Matkl>00107</Matkl>
<Text>Miscelleanous</Text>
</item>
<item>
<Matkl>002</Matkl>
<Text>Electronics</Text>
</item>
<item>
<Matkl>00207</Matkl>
<Text>Monitors</Text>
</item>
<item>
<Matkl>007</Matkl>
<Text>Services</Text>
</item>
<item>
<Matkl>008</Matkl>
<Text>Packaging</Text>
</item>
<item>
<Matkl>01</Matkl>
<Text>Material Group 01</Text>
</item>
<item>
<Matkl>00208</Matkl>
<Text/>
</item>
<item>
<Matkl>014</Matkl>
<Text/>
</item>
The right thing to do would be to use an NSXMLDocument to parse the string and get the text out, which you then can concatenate to a new string if you wish. Have a look here:
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSXMLDocument_Class/Reference/Reference.html
Alternatively you could use an NSScanner to scan to the first occurrence of '>', then get all text until the occurrence of '<', then scan to the next occurrence of '>', and so on - you get the picture. NSScanner is described here:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/Scanners.html