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

generate uuid and check soap envelope

Expand Messages
  • tilmant_a
    Hi, I would like to generate an UUID using soaplite. Data::uuid seems to be good way to do that but I can t succeed in installing it in windows 2003 server.
    Message 1 of 1 , Jan 25, 2006
    • 0 Attachment

      Hi,

      I would like to generate an UUID using soaplite.  Data::uuid seems to be good way to do that but I can't succeed in installing it in windows 2003 server.

      If someone can help me?

      Otherwise I try to implement this soap envelope

      <?xml version="1.0" encoding="UTF-8"?>
      <env:Envelope xmlns:env="
      http://www.w3.org/2003/05/soap-envelope"
        xmlns:wsa="
      http://schemas.xmlsoap.org/ws/2004/08/addressing"
        xmlns:wse="
      http://schemas.xmlsoap.org/ws/2004/08/eventing"
        xmlns:wsen="
      http://schemas.xmlsoap.org/ws/2004/09/enumeration"
        xmlns:wsman="
      http://schemas.xmlsoap.org/ws/2005/06/management"
        xmlns:wsmancat="
      http://schemas.xmlsoap.org/ws/2005/06/wsmancat"
        xmlns:wxf="
      http://schemas.xmlsoap.org/ws/2004/09/transfer" xmlnss="http://www.w3.org/2001/XMLSchema">
        <env:Header>
          <wsa:To env:mustUnderstand="true">http://localhost:8080/wsman/</wsa:To>
          <wsman:ResourceURI>wsman:system/2005/02/this</wsman:ResourceURI>
          <wsa:Action env:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Get</wsa:Action>
          <wsa:ReplyTo>
            <wsa:Address env:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
          </wsa:ReplyTo>
          <wsa:MessageID env:mustUnderstand="true">uuid:b184ed90-e6a5-49db-a640-e9f883003e07</wsa:MessageID>
        </env:Header>
        <env:Body/>
      </env:Envelope>

      This is my code :

      package SOAP::Header;
      package SOAP:ata;
      use SOAP::Lite +trace ;

      my $client=SOAP::Lite->new();
      $client->envprefix('env');

      $client->serializer()->register_ns('http://schemas.xmlsoap.org/ws/2004/08/addressing', 'wsa');
      $client->serializer()->register_ns('http://schemas.xmlsoap.org/ws/2005/06/management', 'wsman');
      $client->serializer()->register_ns('http://schemas.xmlsoap.org/ws/2004/08/eventing','wse');
      $client->serializer()->register_ns('http://schemas.xmlsoap.org/ws/2004/09/enumeration', 'wsen');
      $client->serializer()->register_ns('http://schemas.xmlsoap.org/ws/2005/06/wsmancat', 'wsmancat');
      $client->serializer()->register_ns('http://schemas.xmlsoap.org/ws/2004/09/transfer', 'wxf');
      $client->serializer()->register_ns('http://www.w3.org/2001/XMLSchema', 'xs');

      $client->proxy("http://localhost:8080/wsman?ResourceURI=wsman:system/2005/02/this");
      $client->uri("
      http://schemas.xmlsoap.org/ws/2004/09/transfer/Get");

      $client->readable(1);

      sub generate_random_string
      {
       my $length_of_randomstring=shift;# the length of the random string to generate

       my @chars=('a'..'f','0'..'9');
       my $random_string;
       foreach (1..$length_of_randomstring)
       {
        # rand @chars will generate a random
        # number between 0 and scalar @chars
        $random_string.=$chars[rand @chars];
       }
       return $random_string;
      }

      #Generate the random string
      my $random_string1=&generate_random_string(8);
      my $random_string2=&generate_random_string(4);
      my $random_string3=&generate_random_string(4);
      my $random_string4=&generate_random_string(4);
      my $random_string5=&generate_random_string(12);

      my $uuid = "uuid:".$random_string1."-".$random_string2."-".$random_string3."-".$random_string4."-".$random_string5;

      import  SOAP:ata 'name';

      $header_To=SOAP::Header->name('To'=>'http://localhost:8080/wsman/')->mustUnderstand(1)->prefix('wsa');
      $header_ResourceURI= SOAP::Header->name('ResourceURI'=>'wsman:system/2005/02/this')->prefix('wsman');

      $header_Action= SOAP::Header->name('Action'=>'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get')->prefix('wsa')->mustUnderstand(1);

      $header_ReplyTO=SOAP::Header->name('ReplyTo'=>\SOAP:ata->value(SOAP:ata->name("Adress"=>'http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous')->mustUnderstand(1)->prefix('wsa')))
      ->prefix('wsa');

      $header_MessageID=SOAP::Header->name('MessageID'=>$uuid)->mustUnderstand(1)->prefix('wsa');

      my $som =$client->getServletInfo($header_To,$header_ResourceURI,$header_Action,$header_ReplyTO,$header_MessageID);
      my $output=$som->result;

      Is it the good way to create the header, because I have always the HTTP error 406 : type Inacceptable !!!

      If someone have an idea ?

      Thanks,

      Amélie

       

       

    Your message has been successfully submitted and would be delivered to recipients shortly.