Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

SOAP call to .NET Service

by Hammy (Scribe)
on Jan 08, 2008 at 05:12 UTC ( #661005=perlquestion: print w/replies, xml ) Need Help??
Hammy has asked for the wisdom of the Perl Monks concerning the following question:

Hello all,
I have, what looks like, a very simple call to a service and I am having a lot of problems getting the connection to be made. I am continually getting the following error:
Server did not recognize the value of HTTP Header SOAPAction: https:// +my.ephit.com/WebServices/Website/GetConditionsText/
I have done a lot of reading and found some forum updates that said there is something wrong with my namespace. I pulled the above namespace right out of the WSDL. Any suggestions you may have would be greatly appreciated. Since it is only a few lines of code I have included my code below:
use SOAP::Lite +trace; my $s = SOAP::Lite -> uri('https://my.ephit.com/WebServices/Website') -> proxy('https://my-test.ephit.com/webservices/website.asmx') -> on_action(sub{sprintf '%s/%s/%s', @_ }); my $Req = SOAP::Data->new(name => 'Req', value => "ASTHMA", type =>'xs +i:string'); my $Gender = SOAP::Data->new(name => 'Gender', value => "MALE", type = +> 'xsi:string'); my $Age = SOAP::Data->new(name => 'Age', value => "38", type => 'xsi:i +nt'); $result = $s->GetConditionsText($Req, $Gender, $Age)->result; return($result);

Replies are listed 'Best First'.
Re: SOAP call to .NET Service
by olus (Curate) on Jan 08, 2008 at 11:58 UTC
    The following code makes the call successfully.
    Changed URI to http (as hossman noticed) and the construct of the onAction header.
    #use SOAP::Lite +trace; use SOAP::Lite; my $s = SOAP::Lite -> uri('http://my.ephit.com/WebServices/Website') -> proxy('http://my-test.ephit.com/webservices/website.asmx') -> on_action(sub{sprintf 'http://my.ephit.com/WebServices/Website/%s' +, $_[1] }); my $Req = SOAP::Data->new(name => 'Req', value => "ASTHMA", type =>'xs +i:string'); my $Gender = SOAP::Data->new(name => 'Gender', value => "MALE", type = +> 'xsi:string'); my $Age = SOAP::Data->new(name => 'Age', value => "38", type => 'xsi:i +nt'); $result = $s->GetConditionsText($Req, $Gender, $Age)->result; use Data::Dumper; print Dumper($result);
      Thank you very much! That solved my problem. I thought it might have something to do with the on_action, but I could not figure it out. You have made my morning!
Re: SOAP call to .NET Service
by hossman (Prior) on Jan 08, 2008 at 06:39 UTC

    I'm not a SOAP expert, and I don't have SOAP::Lite installed so i can't test this, but did you read the docs about "uri" carefully? ....

    WARNING: URIs are just identifiers. They may look like URLs, but they are not guaranteed to point to anywhere and shouldn't be used as such pointers. URIs assume to be unique within the space of all XML documents, so consider them as unique identifiers and nothing else.

    The targetNamespace in the WSDL i assume you are refering to is "http://my.ephit.com/WebServices/Website" .. not "https://my.ephit.com/WebServices/Website" like you have in your code.

    (Just because the URL that a namespace ID looks like redirects to another URL -- which 404s -- doesn't mean you can use that redirected URL as a namespace ID ... it's a namespace ID, not a URL, ... no matter how much it may look like one).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://661005]
Approved by randyk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2018-11-14 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (172 votes). Check out past polls.

    Notices?