[Israel.pm] SOAP in perl

ik idokan at gmail.com
Wed Jul 30 10:25:04 PDT 2008


After a long and hard work, where even SOAP::Lite did not work, I used
curl instead.It seems that by using an existed valid XML that I only
changing the content with curl works better then any other
implementation. I still do not know if that was IIS, c# web services
or something else, but only curl was able to properly send the content
the way C# liked it.

I only customized the headers, one was text/xml (without charset !!!
the charset in the header did not work for me), and with SOAPAction as
needed by the application. The rest where the default settings of
curl.

Ido

On Tue, Jul 29, 2008 at 10:27 PM, Uri Bruck <bruck at actcom.net.il> wrote:
> And one more thing - you should mind data types.
> Uri Bruck wrote:
>> ik wrote:
>>
>>> Hello,
>>>
>>> I'm trying  to send a soap xml to a .net soap server using perl (why
>>> does .net have to use SOAP for such simple update ?! errr).
>>>
>>>
>> It doesn't have to.
>>
>>> I found SOAP::Lite to be over complicated to my understanding, so I
>>> tried to use LWP instead.
>>> an example for what I'm doing is as follows:
>>>
>>> sub send_content
>>> {
>>>   my $content = shift or return 0;
>>>   my $ua = LWP::UserAgent->new;
>>>   $ua->agent("WashingSOAP/0.1");
>>>
>>>   # Create a request
>>>   my $req = HTTP::Request->new(POST => 'http://...../');
>>>   $req->header('SOAPAction' => '"http://tempuri.org/Save"');
>>>   $req->content_type('application/soap+xml; charset=utf-8');
>>>   #$req->content_type('text/xml; charset=utf-8');
>>>   $req->content($content);
>>>
>>>   # Pass request to the user agent and get a response back
>>>   my $res = $ua->request($req);
>>>
>>>   # Check the outcome of the response
>>>   if ($res->is_success)
>>>   {
>>>     return $res->content;
>>>   }
>>>   else
>>>   {
>>>     return 0;
>>>   }
>>> }
>>>
>>> I'm always having 500 error, and I wonder if anyone knows what am I
>>> missing (the XML I'm sending seems to be valid according to the .net
>>> people).
>>>
>>>
>> Would these be the .net people responsible for the server?
>> If so, could you ask them for some log that shows what happens when the
>> query reaches the server?
>> Is your XML  message style or RPC style?
>> In the latter case, if you're miscalling the method, either by name or
>> by signature, it could be the cause of the error.
>>
>> I don't think SOAP::Lite should be more complicated than generating your
>> own XML message, quite the contrary, it's not the only option in Perl.
>> There're also
>> SOAP::XML::Client
>> SOAP::XML::Client::Generic
>> SOAP::XML::Client::DotNet
>>
>> Most of my experience was with SOAP::Lite and I haven't had a chance to
>> try those modules yet, but it might be worth your while to try that last
>> one.
>>
>>
>>> Thanks,
>>> Ido
>>>
>>>
>>
>>
>>
>
>
> --
> Thanks,
> Uri
> http://translation.israel.net
>
> Si fractum non sit, noli id reficere.
>
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl
>



-- 
http://ik.homelinux.org/



More information about the Perl mailing list