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
Result: ----------Record 1-------------------- SOAP::Transport::HTTP::Client::send_receive: POST http://bcv50s6e.vz.c +it.a.com:6055/soap/WSSparePartProcessforeSpare Accept: text/xml Accept: multipart/* Content-Length: 4174 Content-Type: text/xml; charset=iso-8859-1 SOAPAction: "http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcess +foreSpare#MyService" <?xml version="1.0" encoding="iso-8859-1"?><SOAP-ENV:Envelope xmlns:SO +AP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingS +tyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http +://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1 +999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body><namesp1:MyService xmlns:namesp1="http://bcv50s6e.vz.ci +t.a.com:6055/soap/WSSparePartProcessforeSpare"> <eSparesMessage> <Header> <Basic> <ServiceType xsi:type="xsd:string">Return for Repair</ServiceType> <OrderType xsi:type="xsd:string">SO</OrderType> <ServiceObjectiveType xsi:type="xsd:string">Deliver</ServiceObjectiveT +ype> </Header> <LineItem> <PartTrackingNumber xsi:type="xsd:string">5-0277051.001</PartTrackingN +umber> <ItemLineNumber xsi:type="xsd:int">1</ItemLineNumber> </LineItem></eSparesMessage> </namesp1:MyService></SOAP-ENV:Body></SOAP-ENV:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.0 200 OK Connection: Close Content-Length: 551 Content-Type: text/xml;charset=utf-8 Client-Date: Mon, 18 May 2009 13:45:52 GMT Client-Peer: 139.54.50.110:6055 Client-Response-Num: 1 Set-Cookie: ssnid=607wTxHRjth3kUcEx81g2G648Lg4bA-6055110; path=/; <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env +elope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xm +lns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.o +rg/2001/XMLSchema-instance"> <SOAP-ENV:Body> <namesp1:ReturnCode xmlns:namesp1="http://www.alu.com/webservices/asi/ +WSSparePartProcessforeSpare"> <Number>409</Number> <Message>Error on SPT 5-0277051.001 RMA already exist</Message> </namesp1:ReturnCode></SOAP-ENV:Body> </SOAP-ENV:Envelope> -----------------Record 2----------------------- SOAP::Transport::HTTP::Client::send_receive: POST http://bcv50s6e.vz.c +it.a.com:6055/soap/WSSparePartProcessforeSpare Accept: text/xml Accept: multipart/* Content-Length: 4851 Content-Type: text/xml; charset=iso-8859-1 SOAPAction: "http://bcv50s6e.vz.cit.a.com:6055/soap/WSSparePartProcess +foreSpare#MyService" <?xml version="1.0" encoding="iso-8859-1"?><SOAP-ENV:Envelope xmlns:SO +AP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingS +tyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http +://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1 +999/XMLSchema-instance" xmlns:xsd="http://www.w3.org/1999/XMLSchema"> <SOAP-ENV:Body><namesp2:MyService xmlns:namesp2="http://bcv50s6e.vz.ci +t.a.com:6055/soap/WSSparePartProcessforeSpare"> <eSparesMessage> <Header> <Basic> <ServiceType xsi:type="xsd:string">Return for Repair</ServiceType> <OrderType xsi:type="xsd:string">SO</OrderType> <ServiceObjectiveType xsi:type="xsd:string">Deliver</ServiceObjectiveT +ype> </Header> <LineItem> <PartTrackingNumber xsi:type="xsd:string">5-0277051.001</PartTrackingN +umber> <ItemLineNumber xsi:type="xsd:int">1</ItemLineNumber> </LineItem></eSparesMessage> </namesp1:MyService></SOAP-ENV:Body></SOAP-ENV:Envelope> SOAP::Transport::HTTP::Client::send_receive: HTTP/1.0 200 OK Connection: Close Content-Length: 483 Content-Type: text/xml;charset=utf-8 Client-Date: Mon, 18 May 2009 13:46:03 GMT Client-Peer: 139.54.50.110:6055 Client-Response-Num: 1 Set-Cookie: ssnid=608VHK+hloKXk7KOxJLtI5+9F|Jh0U-6055110; path=/; <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env +elope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xm +lns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.o +rg/2001/XMLSchema-instance"> <SOAP-ENV:Body> <namesp1:ReturnCode xmlns:namesp1="http://www.alu.com/webservices/asi/ +WSSparePartProcessforeSpare"> <Number>2</Number> </namesp1:ReturnCode></SOAP-ENV:Body> </SOAP-ENV:Envelope> Script: foreach $rank_temp (@temp_arr){ ......Queries for rank to get corresponding records...... ......Loop for each record...... foreach (keys %eSpares_entries){ $service = SOAP::Lite->uri($wsdl_path) ->proxy($proxy_path) ->encoding('iso-8859-1'); ......Get required data to be sent through EAI...... foreach $prd_id (keys %prd_entries){ $lineitem++; $lineitem_data = SOAP::Data->name('LineItem' + => \SOAP::Data->value(SOAP::Data ->name('PartTrackingNumber' => + $prd_entries{$prdid}->{$prd_field_values{'Supplier Service Order'}}) +, SOAP::Data ->name('ItemLineNumber' +=> $lineitem), SOAP::Data ->name('MaterialCode' => + '3AL01001PP'), SOAP::Data ->name('SwapAllowed' + => $swap_allowed), SOAP::Data ->name('ScrapAllowed' => + $scrap_allowed), SOAP::Data ->name('ReturnWarrantyFlag' +=> $prd_entries{$prdid}->{$prd_field_values{'Return Warranty Flag'}}) +, SOAP::Data ->name('WBSNumber' = +> $sae_entries{$sae_id}->{$wbs_field_name}), SOAP::Data ->name('InventoryAccount' => + $prd_entries{$prdid}->{$prd_field_values{'Inventory Account'}}), SOA +P::Data ->name('ProblemSummary' +=> $prd_entries{$prdid}->{$prd_field_values{'Problem Description'}}), + SOAP::Data ->name('SWRelease' = +> $prd_entries{$prdid}->{$prd_field_values{'Additional Info'}}))); push (@lineitem_arr, $lineitem_data); } $header_data = SOAP::Data->name('eSparesMessage' + => \SOAP::Data->value(SOAP::Data ->name('Header' + => \SOAP::Data->value(SOAP::Data ->name('Basic' + => \SOAP::Data->value(SOAP::Data ->name('ServiceType' + => $supp_serv_ord_type), SOAP::Data ->name('DirectShipmentIndica +tor' => 'Y'), SOAP::Data ->name('OperationalFlowIndic +ator' => 'C'), SOAP::Data ->name('CustomerRequestedDat +e' => $cust_req_date), SOAP::Data ->name('IncotermsType' + => 'DDP'), SOAP::Data ->name('IncotermsCity' + => $inc_city), SOAP::Data ->name('PaymentTerm' + => $pay_term), SOAP::Data ->name('B2BAgreementNumber' + => $b2b_agreement), SOAP::Data ->name('ServiceSLA' + => $service_sla), SOAP::Data ->name('ReplenishmentFlag' + => $rep_flag), SOAP::Data ->name('RMANumber' + => $rma_number), SOAP::Data ->name('CustomerReference' + => $customer_reference), SOAP::Data ->name('DeliveryTimeLine' + => $delivery_time_line),SOAP::Data ->name('DirectShipmentIndica +tor' => 'Y')) ), SOAP::Data ->name('lines' + => @lineitem_arr)))); ..... Send data to EAI...... $result = $service[$y]->MyService($header_data); }

In reply to SOAP::Lite - Issue with sending new requests to EAI while looping through multiple records (namespace) by vignesh

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.