Bill.Costa has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to connect to a WebLogic (Oracle) SOAP service. I was given an example using LWP::UserAgent that works with a hand coded envelope, but I liked to use a Perl SOAP module instead. Using that small working LWP script, substituting an envelope generated by SOAP::Lite doesn't work against the server (it complains "Cannot find dispatch method"). But an envelope generated by SOAP::WSDL::Manual, using the WSDL supplied by the WebLogic server does. Great! The thing is I cannot figure out is how to do the authentication with SOAP::WSDL::Manual. The document SOAP::WSDL::Manual::Cookbook has some advice on authentication that I'm afraid I just don't understand. Basically what works with LWP::UserAgent is:
my $CREDENTIALS = 'Basic ' . MIME::Base64::encode($UNAM . ':' . $PWD); my $request = HTTP::Request->new(POST => $END_POINT); $request->header(Authorization => $CREDENTIALS);
What I don't understand is how to reach into the transport layer within SOAP::WSDL::Manual object to set this. Heck, I haven't even figured out what modules are being used to do the HTTP. I'm hoping somebody can either help me with the authentication problem, or suggest a different Perl SOAP module known to play nice with Oracle's WebLogic SOAP services.

Replies are listed 'Best First'.
Re: SOAP::WSDL::Manual and WebLogic authentication
by runrig (Abbot) on Jul 15, 2013 at 21:37 UTC

    If you want to try a different bunch of modules, I'd sugggest XML::Compile. Modifying the http header seems to be covered here. For SOAP::Lite (which I believe SOAP::WSDL uses), modifying the request header is covered here, but I'm not sure how what exactly to specify in SOAP::WSDL.

    Update: Basic auth in SOAP::Lite is covered here.

      Thanks for the XML::Compile pointer. XML::Pastor also looks promising, at least from the standpoint of my handing it an XSD for generating Perl code for me. As for SOAP::Lite -- I stopped looking at it when it failed to generate an envelope that the server liked. The envelope was sufficiently different from what does work, I set it aside. I think you are right, however, that the authentication problem is probably easier to solve with SOAP::Lite. Perhaps the envelope problem is worth look at in more detail.
      # Handcraft XML -- works. my $SOAP_UI_MIN = <<'END_SOAP_UI_MIN'; <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://mysrv.xyz.foo.edu/"> <soapenv:Body> <ser:userSearch> <firstName>John</firstName> <lastName>Smith</lastName> </ser:userSearch> </soapenv:Body> </soapenv:Envelope> END_SOAP_UI_MIN # Generated by SOAP::WSDL -- works. my $PSOAP_WSDL_MIN = <<'END_PSOAP_WSDL_MIN'; <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" > <SOAP-ENV:Body> <userSearch xmlns="http://mysrv.xyz.foo.edu/"> <firstName xmlns="">John</firstName> <lastName xmlns="">Smith</lastName> </userSearch> </SOAP-ENV:Body> </SOAP-ENV:Envelope> END_PSOAP_WSDL_MIN # Generated by SOAP::Lite -- doesn't work. my $PSOAP_LITE_MIN = <<'END_PSOAP_LITE_MIN'; <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <userSearch xmlns="https://mysrv.xyz.foo.edu/idService/userSearchReq +uest"> <c-gensym3> <firstName xsi:type="xsd:string">John</firstName> <lastName xsi:type="xsd:string">Smith</lastName> </c-gensym3> </userSearch> </soap:Body> </soap:Envelope> END_PSOAP_LITE_MIN
      The last is rejected with...
      Cannot find dispatch method for {https://mysrv.xyz.foo.edu/idService/u +serSearchRequest}userSearch
      I'm clueless about why SOAP::Lite generates what it does from the WSDL or how to coerce it to generate an acceptable envelope.
        The namespaces and other attributes in the SOAP body should be coming from the wsdl, so I can't comment on what's supposed be there.