By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,692 Members | 1,998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,692 IT Pros & Developers. It's quick & easy.

SOAP::Lite Issue with sending new request to EAI while looping thru multiple record

P: 1
Hi,

I have been working on a script that loops through multiple records and sends data (one record per call) to a WS.

I am supposed to make a new call for each record before sending the data.
The problem I have is the first record gets processed fine where as the second record always; reason being the EAI expects it to be a seperate call
Though I am creating/reseting a new service everytime within the foreach loop the data seems to be going as a single call.

If you see record 1 and 2 below it has 2 different namespace i.e. namesp1 and namesp2; The EAI is expection namesp1 for both.

Any suggestions on this would be greatly appreciated.

Please find the sample code below

Thanks,
Vignesh


Expand|Select|Wrap|Line Numbers
  1. Result:
  2.  
  3. ----------Record 1--------------------
  4.  
  5. SOAP::Transport::HTTP::Client::send_receive: POST http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcessforeSpare
  6. Accept: text/xml
  7. Accept: multipart/*
  8. Content-Length: 4174
  9. Content-Type: text/xml; charset=iso-8859-1
  10. SOAPAction: "http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcessforeSpare#MyService"
  11.  
  12. <?xml version="1.0" encoding="iso-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  13. <SOAP-ENV:Body><namesp1:MyService xmlns:namesp1="http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcessforeSpare">
  14. <eSparesMessage>
  15. <Header>
  16. <Basic>
  17. <ServiceType xsi:type="xsd:string">Return for Repair</ServiceType>
  18. <OrderType xsi:type="xsd:string">SO</OrderType>
  19. <ServiceObjectiveType xsi:type="xsd:string">Deliver</ServiceObjectiveType>
  20. </Header>
  21. <LineItem>
  22. <PartTrackingNumber xsi:type="xsd:string">5-0277051.001</PartTrackingNumber>
  23. <ItemLineNumber xsi:type="xsd:int">1</ItemLineNumber>
  24. </LineItem></eSparesMessage>
  25. </namesp1:MyService></SOAP-ENV:Body></SOAP-ENV:Envelope>
  26.  
  27. SOAP::Transport::HTTP::Client::send_receive: HTTP/1.0 200 OK
  28. Connection: Close
  29. Content-Length: 551
  30. Content-Type: text/xml;charset=utf-8
  31. Client-Date: Mon, 18 May 2009 13:45:52 GMT
  32. Client-Peer: 139.54.50.110:6055
  33. Client-Response-Num: 1
  34. Set-Cookie: ssnid=607wTxHRjth3kUcEx81g2G648Lg4bA-6055110; path=/;
  35.  
  36. <?xml version="1.0" encoding="UTF-8"?>
  37. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  38. <SOAP-ENV:Body>
  39. <namesp1:ReturnCode xmlns:namesp1="http://www.alu.com/webservices/asi/WSSparePartProcessforeSpare">
  40.   <Number>409</Number>
  41.   <Message>Error on SPT 5-0277051.001 RMA already exist</Message>
  42. </namesp1:ReturnCode></SOAP-ENV:Body>
  43. </SOAP-ENV:Envelope>
  44.  
  45.  
  46.  
  47. -----------------Record 2-----------------------
  48. SOAP::Transport::HTTP::Client::send_receive: POST http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcessforeSpare
  49. Accept: text/xml
  50. Accept: multipart/*
  51. Content-Length: 4851
  52. Content-Type: text/xml; charset=iso-8859-1
  53. SOAPAction: "http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcessforeSpare#MyService"
  54.  
  55. <?xml version="1.0" encoding="iso-8859-1"?><SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  56. <SOAP-ENV:Body><namesp2:MyService xmlns:namesp2="http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcessforeSpare">
  57. <eSparesMessage>
  58. <Header>
  59. <Basic>
  60. <ServiceType xsi:type="xsd:string">Return for Repair</ServiceType>
  61. <OrderType xsi:type="xsd:string">SO</OrderType>
  62. <ServiceObjectiveType xsi:type="xsd:string">Deliver</ServiceObjectiveType>
  63. </Header>
  64. <LineItem>
  65. <PartTrackingNumber xsi:type="xsd:string">5-0277051.001</PartTrackingNumber>
  66. <ItemLineNumber xsi:type="xsd:int">1</ItemLineNumber>
  67. </LineItem></eSparesMessage>
  68. </namesp1:MyService></SOAP-ENV:Body></SOAP-ENV:Envelope>
  69.  
  70. SOAP::Transport::HTTP::Client::send_receive: HTTP/1.0 200 OK
  71. Connection: Close
  72. Content-Length: 483
  73. Content-Type: text/xml;charset=utf-8
  74. Client-Date: Mon, 18 May 2009 13:46:03 GMT
  75. Client-Peer: 139.54.50.110:6055
  76. Client-Response-Num: 1
  77. Set-Cookie: ssnid=608VHK+hloKXk7KOxJLtI5+9F|Jh0U-6055110; path=/;
  78.  
  79. <?xml version="1.0" encoding="UTF-8"?>
  80. <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  81. <SOAP-ENV:Body>
  82. <namesp1:ReturnCode xmlns:namesp1="http://www.alu.com/webservices/asi/WSSparePartProcessforeSpare">
  83.   <Number>2</Number>
  84. </namesp1:ReturnCode></SOAP-ENV:Body>
  85. </SOAP-ENV:Envelope>
  86.  
Script:
Expand|Select|Wrap|Line Numbers
  1. foreach $rank_temp (@temp_arr){
  2.  
  3.         ......Queries for rank to get corresponding records......
  4.  
  5.         ......Loop for each record......
  6.         foreach  (keys %eSpares_entries){
  7.  
  8.             $service = SOAP::Lite->uri($wsdl_path)
  9.                           ->proxy($proxy_path)
  10.                          ->encoding('iso-8859-1');
  11.  
  12.  
  13.             ......Get required data to be sent through EAI......
  14.  
  15.  
  16.              foreach $prd_id (keys %prd_entries){
  17.  
  18.                 $lineitem++;
  19.                 $lineitem_data = SOAP::Data->name('LineItem'            => \SOAP::Data->value(SOAP::Data
  20.                                        ->name('PartTrackingNumber'  => $prd_entries{$prdid}->{$prd_field_values{'Supplier Service Order'}}), SOAP::Data
  21.                                        ->name('ItemLineNumber'        => $lineitem), SOAP::Data
  22.                                        ->name('MaterialCode'        => '3AL01001PP'), SOAP::Data
  23.                                        ->name('SwapAllowed'            => $swap_allowed), SOAP::Data
  24.                                        ->name('ScrapAllowed'        => $scrap_allowed), SOAP::Data
  25.                                        ->name('ReturnWarrantyFlag'    => $prd_entries{$prdid}->{$prd_field_values{'Return Warranty Flag'}}), SOAP::Data
  26.                                        ->name('WBSNumber'            => $sae_entries{$sae_id}->{$wbs_field_name}), SOAP::Data
  27.                                        ->name('InventoryAccount'    => $prd_entries{$prdid}->{$prd_field_values{'Inventory Account'}}), SOAP::Data
  28.                                        ->name('ProblemSummary'        => $prd_entries{$prdid}->{$prd_field_values{'Problem Description'}}), SOAP::Data
  29.                                        ->name('SWRelease'            => $prd_entries{$prdid}->{$prd_field_values{'Additional Info'}})));
  30.  
  31.                 push (@lineitem_arr, $lineitem_data);
  32.             }
  33.  
  34.  
  35.                  $header_data =    SOAP::Data->name('eSparesMessage'                => \SOAP::Data->value(SOAP::Data 
  36.                                           ->name('Header'                        => \SOAP::Data->value(SOAP::Data
  37.                                           ->name('Basic'                        => \SOAP::Data->value(SOAP::Data
  38.                                           ->name('ServiceType'                    => $supp_serv_ord_type), SOAP::Data
  39.                                           ->name('DirectShipmentIndicator'        => 'Y'), SOAP::Data
  40.                                           ->name('OperationalFlowIndicator'     => 'C'), SOAP::Data
  41.                                           ->name('CustomerRequestedDate'        => $cust_req_date), SOAP::Data
  42.                                           ->name('IncotermsType'                => 'DDP'), SOAP::Data
  43.                                           ->name('IncotermsCity'                => $inc_city), SOAP::Data
  44.                                           ->name('PaymentTerm'                    => $pay_term), SOAP::Data
  45.                                           ->name('B2BAgreementNumber'            => $b2b_agreement), SOAP::Data
  46.                                           ->name('ServiceSLA'                    => $service_sla), SOAP::Data
  47.                                           ->name('ReplenishmentFlag'            => $rep_flag), SOAP::Data
  48.                                           ->name('RMANumber'                    => $rma_number), SOAP::Data
  49.                                           ->name('CustomerReference'            => $customer_reference), SOAP::Data
  50.                                           ->name('DeliveryTimeLine'                => $delivery_time_line),SOAP::Data
  51.                                           ->name('DirectShipmentIndicator' => 'Y'))
  52.                                             ), SOAP::Data
  53.                                           ->name('lines'                        => @lineitem_arr)))); 
  54.  
  55.             ..... Send data to EAI......
  56.             $result = $service[$y]->MyService($header_data);
  57.  
  58.             }
  59.  
May 19 '09 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.