Loading ...
Sorry, an error occurred while loading the content.

2155SSL using https fails

Expand Messages
  • c002928
    Dec 2, 2002
    • 0 Attachment
      This code works fine when I set endpoint to http://... etc. but when
      using https it fails. Java and .Net clients work OK setting enpoint
      url to https. The error i get is:
      SOAP::Transport::HTTP::Client::send_receive: 501 (not implemented)

      https not supported. I also get the error:
      SOAP::Transport::HTTP::Client::send_receive: 500 (internal server
      error) can't locate object method "new" via
      package "LWP::Protocol::HTTP::Socket" (perhaps you forgot to
      load "LWP::Protocol::HTTP::Socket")

      Could it be that the asmx service only supports https via SOAP
      protocol and not HTTPPost? Does SOAP::Lite have a way to support
      SOAP calls without HTTPPost or HTTPGet?

      Also I would rather use the credentials way of authenticating but
      this always requires 2 requests. The first one always fails. Is
      there a way to preauthenticate?

      Thank you.
      Scott Daniel


      #!c:\Perl\bin\perl -w

      use SOAP::Lite +trace => 'debug';

      #// Tests all seven methods of XmlSelect Web Service
      #####################################################################
      ##############################################
      #// Set SOAPAction method.
      $action = 'SubmitXml';

      #// Declare and initialize method parameters for SubmitXml action.
      #// Method signature: xmlelement SubmitXml(string Profile,
      xmlelement Request, xmlelement Filter)

      #// <Profile> tag gets automagically wrapped around this parameter's
      data in
      #// $soap->call() below by SOAP::Lite because it is of simple type
      string.
      $profile = 'ApolloProd_ABC123';

      #// Request parameter is complex data type xmlelement.
      #// SOAP::Lite does not add the <Request> tag around
      #// the data in $soap->call() below since type is 'xml'.
      #// Data is wrapped here with appropriate <Request> tag.
      $request = '
      <Request>
      <LocalDateTimeCT_6_0 xmlns="">
      <LocalDateTimeMods>
      <ReqCity>ORD</ReqCity>
      </LocalDateTimeMods>
      </LocalDateTimeCT_6_0>
      </Request>';

      #// Filter parameter is complex data type xmlelement.
      #// SOAP::Lite does not add the <Filter> tag around
      #// the data in $soap->call() below since type is 'xml'.
      #// Data is wrapped here with appropriate <Filter> tag.
      $filter = '
      <Filter>
      <_ xmlns="" />
      </Filter>';

      #// Declare and initialize variables for namespace, and endpoint as
      well as credentials for web service.
      $namespace = 'http://webservices.galileo.com';
      $endpoint
      = 'https://username:password@servername/xmlselect/xmlselect.asmx';
      #$host_and_port = 'ws.galileo.com:80';
      #$realm = ''; #// no domain name needed, use empty string.
      #$username = 'username';
      #$password = 'password';


      #// Create Soap::Lite object called $soap1 and set uri namespace as
      $namespace.
      #// Soap::Lite creates SOAPAction like this
      http://webservices.galileo.com#SubmitXml
      #// but .NET requires SOAPAction like this
      http://webservices.galileo.com/SubmitXml
      #// so on_action() is used to replace # with /.
      #// Set proxy endpoint as $endpoint.
      #// Response will be a hash value by default since return type is
      complex xmlelement,
      #// so set response to xml by passing true("1") into outputxml()
      method.
      my $soap = SOAP::Lite
      -> uri($namespace)
      -> on_action(sub{sprintf '%s/%s', @_ })
      -> outputxml("1")
      #-> proxy($endpoint,credentials=>[$host_and_port, $realm,
      $username=>$password]);
      -> proxy($endpoint);

      #// Create object called $response. Assign the return
      #// value of the $soap object's call to method SubmitXml to
      $response.
      #// Set the namespace for all of the SubmitXml method parameters
      #// with this long version of the call() method to make everything
      #// hunkydory for .Net
      my $response = $soap
      ->call(SOAP::Data->name($action)->attr({xmlns =>
      $namespace}),SOAP::Data->name(Profile => $profile)->type
      ('string'),SOAP::Data->name(Request => $request)->type
      ('xml'),SOAP::Data->name(Filter => $filter)->type('xml'));

      #// Print out SubmitXml response;
      print $response;
    • Show all 2 messages in this topic