O how i beg for your help.

for the past 3 days i have been trying to complete a soap request using soap::lite. i have read the docs, browsed the monestary and searched the internet and have still not been able to successfully send a valid request and receive a response.

below is the code i am trying to use to produce the xml request which i also show below.

any and all help as always is much appreciated.

xml trying to be created using soap::lite:
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope> <SOAP-ENV:Body> <typens:newAccount xmlns:typens="urn:HELP"> <primary xsi:type="typens:LoginInfo"> <username xsi:type="xsd:string">myusername</username> <password xsi:type="xsd:string">mypwd</password> + </primary> <securityid xsi:type="xsd:string">123456789</securityid> <personalinfo xsi:type="typens:PersonalInfo"> <pin xsi:type="xsd:string">1554</pin> <street xsi:type="xsd:string">123 test st</street> <contact xsi:type="xsd:string">John Down</contact> </personalinfo> </typens:newAccount> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
notice there are name spaces in the above xml. i cannot seem to be able to successfully create a call that is accepted by the server to mimic what is shown above. the code i am using (at least the current try) is:
$SendObject = SOAP::Lite -> service('https://mydomain.com/filname.wsdl') -> uri('https://mydomain.com/server.php'); $response = $SendObject -> newDomain( SOAP::Data->name('username' => ' +myusername'), SOAP::Data->name('password' => 'mwowd'), SOAP::Data->name('securityid' => '123456789'), SOAP::Data->name('pin' => '1554'), SOAP::Data->name('street' => '123 street'), SOAP::Data->name('contact' => 'John Doe') + );
==================UPDATE===================

you can biuld a raw xml message and send it using soap::lite as shown in the following snippet. this avoids the frustration i was running into using the soap object and seems to work for my case at least.

if there is an issue with this that someone is aware of please let me know.
my $xml = '<primary xsi:type="typens:LoginInfo"> <username xsi:type="xsd:string">myusername</username> <password xsi:type="xsd:string">mypwd</password> + </primary> <securityid xsi:type="xsd:string">123456789</securityid> <personalinfo xsi:type="typens:PersonalInfo"> <pin xsi:type="xsd:string">1554</pin> <street xsi:type="xsd:string">123 test st</street> <contact xsi:type="xsd:string">John Down</contact> </personalinfo>'; my $response= SOAP::Lite -> service('https://mydomain.com/service.wsdl') + -> outputxml(1) -> newAccount( SOAP::Data->type('xml' => $xml) ); print $response;
$response will contain the raw xml response from the service call and you will be able to parse that using XML::Simple or whatever you need to do with it.

Hope that helps someone.

In reply to how to send a request with soap::lite by bear0053

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.