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

Connection to .net WCF Service + authorization

Expand Messages
  • nulibali
    Hi, I m new to perl and soap and didn t find any solutions for my problem so maybe you can help me. I have a .net WCF Service, Soap 1.2, with authorization
    Message 1 of 1 , Feb 19, 2010
    View Source
    • 0 Attachment
      Hi,

      I'm new to perl and soap and didn't find any solutions for my problem so maybe you can help me.

      I have a .net WCF Service, Soap 1.2, with authorization which I try to connect with perl.

      The error message says :
      "The security context token is expired or is not valid. The message was not processed."

      I have installed a certificate on my PC, is it possible the problem is related to that? How can I solve it?

      Any help is appreciated!!

      Thanks,
      Mareike

      Here is my test code + output:


      #--------------------------------------------------------------------
      use URI;
      use SOAP::Lite +trace=>debug;
      use Data::Dumper;

      use strict;
      use warnings;

      print "BEGIN\n";

      my $soap = SOAP::Lite->new()
      -> uri('urn:EnterpriseServer.Services.ServiceContract')
      -> proxy('http://Username:Password@192.168.233.17:8081/ServiceName/Soap12', timeout => 60)
      ->soapversion('1.2')
      ->envprefix('soap12');

      $SOAP::Constants::DEFAULT_HTTP_CONTENT_TYPE = 'application/soap+xml';

      print $soap -> Ping();

      print "END\n";

      sub SOAP::Transport::HTTP::Client::get_basic_credentials {
      return 'Username' => 'Password';
      }

      exit

      #--------------------------------------------------------------------


      Output:
      ----------------
      BEGIN
      SOAP::Transport::HTTP::Client::send_receive: POST http://Username:Password@192.168.233.17:8081/ServiceName/Soap12 HTTP/1.1
      Accept: text/xml
      Accept: multipart/*
      Accept: application/soap
      Content-Length: 529
      Content-Type: application/soap+xml; charset=utf-8
      SOAPAction: "urn:EnterpriseServer.Services.ServiceContract
      #Ping"

      <?xml version="1.0" encoding="UTF-8"?><soap12:Envelope xmlns:soap12="http://www.
      w3.org/2003/05/soap-envelope" soap:encodingStyle="http://schemas.xmlsoap.org/soa
      p/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapen
      c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/
      XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap12:Body><P
      ing xmlns="urn:EnterpriseServer.Services.ServiceContract"
      xsi:nil="true" /></soap12:Body></soap12:Envelope>
      SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
      Date: Fri, 19 Feb 2010 10:47:16 GMT
      Server: Microsoft-HTTPAPI/1.0
      Content-Length: 562
      Content-Type: application/soap+xml; charset=utf-8
      Client-Date: Fri, 19 Feb 2010 10:47:18 GMT
      Client-Peer: 192.168.233.17:8081
      Client-Response-Num: 1

      <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://ww
      w.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://www
      .w3.org/2005/08/addressing/soap/fault</a:Action></s:Header><s:Body><s:Fault><s:C
      ode><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://schemas.xmlso
      ap.org/ws/2005/02/sc">a:BadContextToken</s:Value></s:Subcode></s:Code><s:Reason>

      <s:Text xml:lang="de-DE">The security context token is expired or is not valid.
      The message was not processed.</s:Text>

      </s:Reason></s:Fault></s:Body></s:Envelop
      e>
      1END
    Your message has been successfully submitted and would be delivered to recipients shortly.