Skip to Content
0

Parsing String Which has XML structure in a SOAP To RFC Sync Interface

Jan 14, 2017 at 12:18 PM

51

avatar image

Hi Everybody,

Below is the input structure coming from web service and i need to parse this to a well formed XML structure including <pBigTxt> which has Order as an header node with 1 to 1 occurrence which has attributes/fields and Line as item node with 0 to unbounded which has attributes/fields.

Input Structure :

<?xml version="1.0" encoding="UTF-8"?>
<CreateOrder>
   <pDynamicsID>38</pDynamicsID>
   <pCustomerNo>300696</pCustomerNo>
   <pBigTxt>
     <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Order OrderID="1125153" CustomerID="PP20101CMUNIEN" UserID="WC10562" DateCreated="20170111" DealerOrderNumber="1125153_TEST" OrderTypeID="021" ShipmentMethodID="Z2" Surcharge="0" Discount="0" SubTotal="356.49" VAT="49.9086" Total="406.3986">
<Line LineID="1" ItemID="0095031" Qty="2.00" DealerUnitCost="0.0000" LineDiscount="0.0000" LineAmount="0.0000" />
<Line LineID="2" ItemID="0095314" Qty="3.00" DealerUnitCost="0.0000" LineDiscount="0.0000" LineAmount="0.0000" />
<Line LineID="3" ItemID="21825666" Qty="4" DealerUnitCost="0" LineDiscount="0" LineAmount="0" />
</Order>
</pBigTxt>
</CreateOrder>

Expected Output Structure:

<?xml version="1.0" encoding="UTF-8"?>
<CreateOrder>
   <pDynamicsID>38</pDynamicsID>
   <pCustomerNo>300696</pCustomerNo>
   <pBigTxt>
     <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Order 
OrderID="1125153" 
CustomerID="PP20101CMUNIEN" 
UserID="WC10562" 
DateCreated="20170111" 
DealerOrderNumber="1125153_TEST" 
OrderTypeID="021" 
ShipmentMethodID="Z2" 
Surcharge="0" 
Discount="0" 
SubTotal="356.49" 
VAT="49.9086" 
Total="406.3986">
<Line 
LineID="1" 
ItemID="0095031" 
Qty="2.00" 
DealerUnitCost="0.0000" 
LineDiscount="0.0000" 
LineAmount="0.0000" />
<Line 
LineID="2" 
ItemID="0095314" 
Qty="3.00" 
DealerUnitCost="0.0000" 
LineDiscount="0.0000" 
LineAmount="0.0000" />
<Line 
LineID="3" 
ItemID="21825666" 
Qty="4" 
DealerUnitCost="0" 
LineDiscount="0" 
LineAmount="0" />
</Order>
</pBigTxt>
</CreateOrder>

I have decided to map the output of well formed XML to a intermediate structure and finally mapping to BAPI to create sales order.I tried to parse input message using Java map however facing difficulties.Any suggestions will highly appreciated.

Thanks

Pavan

input.jpg (162.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Pavan kumar Jan 14, 2017 at 12:52 PM
0

i dont need pBigTxt .Could not update the thread due to some issues hence posting as a separate comment

<?xml version="1.0" encoding="UTF-8"?>
<CreateOrder>
   <pDynamicsID>38</pDynamicsID>
   <pCustomerNo>300696</pCustomerNo>
  <Order 
OrderID="1125153" 
CustomerID="PP20101CMUNIEN" 
UserID="WC10562" 
DateCreated="20170111" 
DealerOrderNumber="1125153_TEST" 
OrderTypeID="021" 
ShipmentMethodID="Z2" 
Surcharge="0" 
Discount="0" 
SubTotal="356.49" 
VAT="49.9086" 
Total="406.3986">
<Line 
LineID="1" 
ItemID="0095031" 
Qty="2.00" 
DealerUnitCost="0.0000" 
LineDiscount="0.0000" 
LineAmount="0.0000" />
<Line 
LineID="2" 
ItemID="0095314" 
Qty="3.00" 
DealerUnitCost="0.0000" 
LineDiscount="0.0000" 
LineAmount="0.0000" />
<Line 
LineID="3" 
ItemID="21825666" 
Qty="4" 
DealerUnitCost="0" 
LineDiscount="0" 
LineAmount="0" />
</Order>
</CreateOrder>
Share
10 |10000 characters needed characters left characters exceeded
Pavan kumar Jan 16, 2017 at 08:15 AM
0

Issue resolved.Problem with the input data tags which has additional ns0: receiving from the web service.

Cheers

Pavan

Share
10 |10000 characters needed characters left characters exceeded