cancel
Showing results for 
Search instead for 
Did you mean: 

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

former_member183908
Active Contributor
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member183908
Active Contributor
0 Kudos

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

Cheers

Pavan

former_member183908
Active Contributor
0 Kudos

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>