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

Re^2: XML::Compile Changing Server Endpoint

by jdudleyh (Novice)
on Jul 02, 2013 at 22:05 UTC ( #1042111=note: print w/ replies, xml ) Need Help??


in reply to Re: XML::Compile Changing Server Endpoint
in thread XML::Compile Changing Server Endpoint

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.


Comment on Re^2: XML::Compile Changing Server Endpoint
Select or Download Code
Re^3: XML::Compile Changing Server Endpoint
by runrig (Abbot) on Jul 02, 2013 at 22:22 UTC
    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://1042111]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2014-04-24 09:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls