Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: XML::Compile Changing Server Endpoint

by Anonymous Monk
on Jun 29, 2013 at 03:53 UTC ( #1041391=note: print w/ replies, xml ) Need Help??


in reply to XML::Compile Changing Server Endpoint

Hmm  [ddg://XML::Compile endpoints] XML::Compile endpoints-> XML::Compile::SOAP::Operation XML::Compile::SOAP::Operation->new(OPTIONS)

endpoints => ADDRESS|ARRAY Where to contact the server.

http://search.cpan.org/tools/XML-Compile-SOAP-2.36 -> http://search.cpan.org/grep?cpanid=MARKOV&release=XML-Compile-SOAP-2.36&string=endpoint&i=1&n=1&C=0

t/50wsdl.t 157:is($wsdl->endPoint, $servaddr); 158:is($wsdl->endPoint(service => $servname), $servaddr);

So I would try setting ->endPoint before and after compileClient


Comment on Re: XML::Compile Changing Server Endpoint
Select or Download Code
Re^2: XML::Compile Changing Server Endpoint
by jdudleyh (Novice) on Jul 02, 2013 at 22:05 UTC

    After a lot of experimenting I've determined that when I override the "address", I lose the definition of "SOAPAction". I try to define it by adding "action=>....", but I still get 404 error (and I don't see it in the "$trace -> printRequest;" output).

    If I don't override the server address (using the one in the WSDL) and specify the correct action, the request works fine.
    If I don't override the server address and specify a bogus action, I get a 404 error (as expected).
    If I override the server address with the same address (just to test) and specify the correct action, I unexpectedly get a 404 error.

    The trace of the request -- using the endpoint address in the WSDL (which works):
    Request: POST http://address.of.server1:18082/ServiceRequest HTTP/1.1 User-Agent: libwww-perl/6.04 Content-Length: 1178 Content-Type: text/xml; charset="utf-8" SOAPAction: "/Processes/ServiceRequest" X-LWP-Version: 6.04 X-XML-Compile-Cache-Version: 0.994 X-XML-Compile-SOAP-Version: 2.36 X-XML-Compile-Version: 1.34 X-XML-LibXML-Version: 2.0018
    The trace of the request -- using the same endpoint address and action, but specified in the calls (which doesn't work):
    Request: POST http://address.of.server1:18082/ServiceRequest HTTP/1.1 User-Agent: libwww-perl/6.04 Content-Length: 1178 Content-Type: text/xml; charset="utf-8" X-LWP-Version: 6.04 X-XML-Compile-Cache-Version: 0.994 X-XML-Compile-SOAP-Version: 2.36 X-XML-Compile-Version: 1.34 X-XML-LibXML-Version: 2.0018

    I need to be able to pass in different server names and override the one in the WSDL. I'd rather avoid the ugliness of multiple copies of the same WSDL as I have many other web services as well.

      I need to be able to pass in different server names and override the one in the WSDL.

      Just throwing out ideas for workarounds...but if you parse the wsdl yourself ( with XML::LibXML->load_xml(..) ) and replace the port/address/@location, you can just pass the LibXML Node object instead of the file to addWSDL() ( or ..::WSDL->new() ). XML::Compile handles more than just files passed to its object constructors.

        "Just throwing out ideas for workarounds...but if you parse the wsdl yourself ( with XML::LibXML->load_xml(..) )" ... "XML::Compile handles more than just files passed to its object constructors."

        Thanks Runrig, that works quite adequately! I hadn't noticed that I could pass the file object to the XML::Compile::WSDL11 constructor.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2015-07-03 20:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (56 votes), past polls