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

SSL using https fails

Expand Messages
  • c002928
    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
    Message 1 of 2 , Dec 2, 2002
    View Source
    • 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;
    • Paul Kulchenko
      Hi Scott, Seems like you don t have LWP::Protocol::https module installed. It will require Crypt::SSLeay module, which requires openssl. As soon as you install
      Message 2 of 2 , Dec 8, 2002
      View Source
      • 0 Attachment
        Hi Scott,

        Seems like you don't have LWP::Protocol::https module installed. It
        will require Crypt::SSLeay module, which requires openssl. As soon as
        you install them you shouldn't have any problems.

        > 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?
        What do you mean by the first one always fails? If server returns
        401/407 status code, that's the way authentication works. Client will
        include credentials in subsequent request. It's possible to include
        all required headers in the first request, so that the second call
        won't be required, but you need to have some information about
        authentication service (realm, name, auth/proxy, basic/digest, and
        the rest). Server returns all this information in the first response.
        All subsequent requests include all information required for
        authentication.

        Best wishes, Paul.

        --- c002928 <scott.daniel@...> wrote:
        > 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;
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do you Yahoo!?
        Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
        http://mailplus.yahoo.com
      Your message has been successfully submitted and would be delivered to recipients shortly.