DSV Ship Multi-Line Multi-Quantity Orders - walmart-api

This may be a long shot but Walmart's support has been completely unhelpful.
For orders containing 2 or more of the same item, Walmart breaks them out into lines of 1 quantity when working with the API. Ex:
<order
xmlns="http://walmart.com/mp/v3/orders">
<purchaseOrderId>xxx</purchaseOrderId>
<customerOrderId>xxx</customerOrderId>
<customerEmailId>xxx</customerEmailId>
<orderDate>xxx</orderDate>
<mart>Walmart.com</mart>
<shippingInfo>...</shippingInfo>
<orderLines>
<orderLine>
<lineNumber>1</lineNumber>
<item>
<productName>xxx</productName>
<sku>xxx</sku>
</item>
<charges>.....</charge>
</charges>
<orderLineQuantity>
<unitOfMeasurement>EACH</unitOfMeasurement>
<amount>1</amount>
</orderLineQuantity>
<statusDate>2021-03-31T22:30:46.890Z</statusDate>
<orderLineStatuses>
<orderLineStatus>
<status>Acknowledged</status>
<statusQuantity>
<unitOfMeasurement>EACH</unitOfMeasurement>
<amount>1</amount>
</statusQuantity>
</orderLineStatus>
</orderLineStatuses>
<originalCarrierMethod>267</originalCarrierMethod>
<fulfillment>....</fulfillment>
</orderLine>
<orderLine>
<lineNumber>1</lineNumber>
<item>
<productName>xxx</productName>
<sku>xxx</sku>
</item>
<charges>....</charge>
</charges>
<orderLineQuantity>
<unitOfMeasurement>EACH</unitOfMeasurement>
<amount>1</amount>
</orderLineQuantity>
<statusDate>2021-03-31T22:30:46.891Z</statusDate>
<orderLineStatuses>
<orderLineStatus>
<status>Acknowledged</status>
<statusQuantity>
<unitOfMeasurement>EACH</unitOfMeasurement>
<amount>1</amount>
</statusQuantity>
</orderLineStatus>
</orderLineStatuses>
<originalCarrierMethod>xxx</originalCarrierMethod>
<fulfillment>...</fulfillment>
</orderLine>
</orderLines>
In the above there are multiple line 1's.
I cannot seem to find a way to submit a shipment for the above order to close all lines at the same time.
My first idea was to submit it in the exact way that the Walmart API returns an order:
<orderShipment xmlns="http://walmart.com/mp/v3/orders">
<orderLines>
<orderLine>
<lineNumber>1</lineNumber>
<orderLineStatuses>
<orderLineStatus>
<status>Shipped</status>
<statusQuantity>
<unitOfMeasurement>Each</unitOfMeasurement>
<amount>1</amount>
</statusQuantity>
<trackingInfo>
<shipDateTime>2021-04-01T11:47:40</shipDateTime>
<carrierName>
<carrier>FedEx</carrier>
</carrierName>
<methodCode>Standard</methodCode>
<carrierMethodCode>67</carrierMethodCode>
<trackingNumber>xxxx</trackingNumber>
<trackingURL>https://www.fedex.com/</trackingURL>
</trackingInfo>
</orderLineStatus>
</orderLineStatuses>
</orderLine>
<orderLine>
<lineNumber>1</lineNumber>
<orderLineStatuses>
<orderLineStatus>
<status>Shipped</status>
<statusQuantity>
<unitOfMeasurement>Each</unitOfMeasurement>
<amount>1</amount>
</statusQuantity>
<trackingInfo>
<shipDateTime>2021-04-01T11:47:40</shipDateTime>
<carrierName>
<carrier>FedEx</carrier>
</carrierName>
<methodCode>Standard</methodCode>
<carrierMethodCode>67</carrierMethodCode>
<trackingNumber>xxxx</trackingNumber>
<trackingURL>https://www.fedex.com/</trackingURL>
</trackingInfo>
</orderLineStatus>
</orderLineStatuses>
</orderLine>
</orderLines>
</orderShipment>
However the API returns the error below:
OrderLine has more than one entry for the same lineNumber. Please check the lineNumber 1
The next thing I tried was to consolidate them into one request:
<orderShipment xmlns="http://walmart.com/mp/v3/orders">
<orderLines>
<orderLine>
<lineNumber>1</lineNumber>
<orderLineStatuses>
<orderLineStatus>
<status>Shipped</status>
<statusQuantity>
<unitOfMeasurement>Each</unitOfMeasurement>
<amount>2</amount>
</statusQuantity>
<trackingInfo>
<shipDateTime>2021-04-01T11:53:48</shipDateTime>
<carrierName>
<carrier>FedEx</carrier>
</carrierName>
<methodCode>Standard</methodCode>
<carrierMethodCode>67</carrierMethodCode>
<trackingNumber>xxxxx</trackingNumber>
<trackingURL>https://www.fedex.com/</trackingURL>
</trackingInfo>
</orderLineStatus>
</orderLineStatuses>
</orderLine>
</orderLines>
</orderShipment>
However this returns a new error:
Unable to process this request. The Line: 1 of PO: xxxx doesn't have enough quantity to ship requested quantity :: 2 qtyAvailableToShip :: 1
I can't think of another approach to ship this? If anyone could shed any light I would greatly appreciate it.

Related

Post method webservice call for rpgle program

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 :)

How to get a distinct collection of nodes in 2 separate parents using XSL 2.0

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!

Storing XML response from webservice into Rails model

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

I stored the result in a variable. I got output with xml tags. I want to replace those tags with empty tags

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>
</it‌​em>
<item>
<Matkl>002</Matkl>
<Text>Electronics</Text>
</item>
<item>
<Matkl>00207</Mat‌​kl>
<Text>Monitors</Text>
</item>
<item>
<Matkl>007</Matkl>
<Text>Services</Text>
</ite‌​m>
<item>
<Matkl>008</Matkl>
<Text>Packaging</Text>
</item>
<item>
<Matkl>01</Matkl>
<Te‌​xt>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

How to implement a VoiceXML Grammar Parser

I am trying to build a Standalone VoiceXML parser which accepts the input as the example below
<grammar version="1.0" root="ROOT" mode="dtmf">
<rule id="ROOT">
<one-of>
<item> 1 </item>
<item> 2 </item>
<item> 3 </item>
<item> 4 </item>
<item> 5 </item>
</one-of>
</rule>
</grammar>
It is easy to write a specific parser for that specific grammar specification. However, I want to have a generic solution/algorithm which can parse/interpret all possible DTMF grammar cases.
I appreciate any help.
Thanks,
-Toan.
There is a very good open source which implements a VXML interpreter. It is JVoiceXML at http://jvoicexml.sourceforge.net/
It also includes a VXML grammar validation engine. I think this is what I am looking for.
Take a look at NuGram.
Open VXI is another open source solution that has been around for a long time. A lot of major telephony vendors have used this as the basis for their IVR platforms.

Resources