Re: SOAP::Lite format

Scott Seely <[email protected]> Tue, 25 Mar 2003 09:31:19 -0800
Newsgroups gmane.comp.windows.devel.soap.general
Message-ID <6CEF693DEA38994786B8F1B115897A2E0B672D33@red-msg-06.redmond.corp.microsoft.com>
The problem is that your WebService is doc/literal but the message you
are sending using SOAP::Lite is rpc/encoded. As a result, the Web
service is interpreting the a_ID member as null when deserialization
kicks in.
Try modifying your Perl to read like this:

my $service = SOAP::Lite
    ->
service('http://XXXXXXXXXXXX.com/WebServices/Demo/wsdemo.asmx?wsdl');
my $result = $service->getPrice($code);

I'm assuming that $code contains the string which identifies the price
code you are looking for. I think this will work. Let us know the
results.
-----Original Message-----
From: Chung [mailto:[email protected]] 
Sent: Tuesday, March 25, 2003 2:05 AM
To: [email protected]

Hello guys,

I am trying to get access to .NET soap service from perl using
SOAP::Lite
and have hit a brickwall....

This is a VALID xml request:
********************************************************
POST /WebServices/Demo/demo.asmx HTTP/1.1
Host: XXXXXXXXXXXX.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: http://XXXXXXXXXXXX.com/WebServices/Demo/getPrice

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getPrice xmlns="http://XXXXXXXXXXXX.com/WebServices/Demo/">
      <a_Id>string</a_Id>
    </getPrice>
  </soap:Body>
</soap:Envelope>
********************************************************

This is a VALID xml reponse:
********************************************************
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getPriceResponse xmlns="http://XXXXXXXXXX.com/WebServices/Demo/">
      <getPriceResult>
        <Id>string</Id>
        <Date>dateTime</Date>
        <MM>decimal</MM>
        <Price>decimal</Price>
        <session>decimal</session>
      </getPriceResult>
    </getPriceResponse>
  </soap:Body>
</soap:Envelope>
********************************************************


I have a problem:

The output from SOAP::Lite is as follows:
********************************************************
Content-Length: 610
Content-Type: text/xml; charset=utf-8
SOAPAction: http://XXXXXXXXXXXX.com/WebServices/Demo/getPrice

<?xml version="1.0" encoding="UTF-8"?>
<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">
<SOAP-ENV:Body>
<namesp1:getPrice
xmlns:namesp1="http://XXXXXXXXXXXX.com/WebServices/Demo">
<a_Id xsi:type="xsd:string">
A0003
</a_Id>
</namesp1:getPrice>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
********************************************************

Which is close but not exactly the same as what is reqired. For example
SOAP-ENV: instead of soap:; ??? </namesp1:getPrice> : instead of
</getPrice>???

Also server response an incorrect result to me.

Response from Server side is as follows:
********************************************************
SOAP::Transport::HTTP::Client::send_receive:
HTTP::Response=HASH(0x8459fb4)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 200 OK
Cache-Control: private, max-age=0
Date: Tue, 23 Mar 2003 07:58:18 GMT
Server: Microsoft-IIS/5.0
Content-Length: 448
Content-Type: text/xml; charset=utf-8
Client-Date: Tue, 23 Mar 2003 08:12:47 GMT

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<getPriceResponse xmlns="http://XXXXXXXX.com/WebServices/Demo/">
<getPriceResult>
<Date>
0001-01-01T00:00:00.0000000+08:00
</Date>
</getPriceResult>
</getPriceResponse>
</soap:Body>

SOAP::Deserializer::deserialize: ()
SOAP::Parser::decode: ()
SOAP::SOM::new: ()
Use of uninitialized value in print at demo.pl line 49.
0001-01-01T00:00:00.0000000+08:00
Use of uninitialized value in print at demo.pl line 51.
Use of uninitialized value in print at demo.pl line 52.
Use of uninitialized value in print at demo.pl line 53.
********************************************************

Can anybody teach me wheres the error and how to solve the problem?

Below is my perl code if this helps

Thanks in advance

Chung

My perl program:

********************************************************
use strict;
use SOAP::Lite +trace => 'all';

my $code = "A0003";

my $hdr =
SOAP::Header->uri('http://XXXXXXXXXXXX.com/WebServices/Demo')->prefix(''
); 

my $s = SOAP::Lite
       -> uri('http://XXXXXXXXXXXX.com/WebServices/Demo')
       -> proxy('http://XXXXXXXXXXXX.com/WebServices/Demo/wsdemo.asmx')
       -> on_action(sub{sprintf '%s/%s', @_ });

my $result = $s->getPrice(
    SOAP::Data->name(a_Id =>
$code)->uri('http://XXXXXXXXXXXX.com/WebServices/Demo')->prefix('')    
);

print $result->{Id}, "\n";
print $result->{Date}, "\n";
print $result->{MM}, "\n";
print $result->{Price}, "\n";
print $result->{session}, "\n";
********************************************************


===================================
This list is hosted by DevelopMentor? http://www.develop.com
You may be interested in Guerrilla Web Services .NET, 14 April 2003, in
Torrance, CA
http://www.develop.com/courses/gwsdotnet

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com
You may be interested in Guerrilla Web Services .NET, 14 April 2003, in Torrance, CA
http://www.develop.com/courses/gwsdotnet

View archives and manage your subscription(s) at http://discuss.develop.com