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

How do I add a namespace to the soap header

Expand Messages
  • oldfic4
    How do get soaplite to add the xmlns:intf ns to get the soap envelope to look as below?
    Message 1 of 5 , Oct 15, 2007
    • 0 Attachment
      How do get soaplite to add the xmlns:intf ns to get the soap envelope
      to look as below?

      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:intf="http://session.webservices.thefirm.uk">

      Thanks
    • Edward Kawas
      Hi, I think that you need to create your own serializer to gain access to the envelope. you might want to refer to
      Message 2 of 5 , Oct 15, 2007
      • 0 Attachment
        Hi,

        I think that you need to create your own serializer to gain access to the
        envelope. you might want to refer to
        http://cookbook.soaplite.com/#overriding%20serializer%20(server) to get an
        idea.

        Eddie

        > -----Original Message-----
        > From: soaplite@yahoogroups.com
        > [mailto:soaplite@yahoogroups.com] On Behalf Of oldfic4
        > Sent: Monday, October 15, 2007 2:20 AM
        > To: soaplite@yahoogroups.com
        > Subject: [soaplite] How do I add a namespace to the soap header
        >
        > How do get soaplite to add the xmlns:intf ns to get the soap
        > envelope to look as below?
        >
        > <soap:Envelope
        > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/
        > <http://schemas.xmlsoap.org/soap/envelope/> "
        > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
        > <http://www.w3.org/2001/XMLSchema-instance> "
        > xmlns:xsd="http://www.w3.org/2001/XMLSchema
        > <http://www.w3.org/2001/XMLSchema> "
        > xmlns:intf="http://session.webservices.thefirm.uk
        > <http://session.webservices.thefirm.uk> ">
        >
        > Thanks
        >
        >
        >
        >
        >
      • Graham Irvine
        ... something like this will do it. my $soap = SOAP::Lite- proxy($proxy); $soap- serializer- soapversion( 1.2 ); $soap- serializer- namespaces({
        Message 3 of 5 , Oct 15, 2007
        • 0 Attachment
          oldfic4 wrote:
          > How do get soaplite to add the xmlns:intf ns to get the soap envelope
          > to look as below?
          >
          > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
          > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          > xmlns:intf="http://session.webservices.thefirm.uk">
          >
          > Thanks
          >
          >
          >
          >

          something like this will do it.

          my $soap = SOAP::Lite->proxy($proxy);
          $soap->serializer->soapversion("1.2");
          $soap->serializer->namespaces({
          "http://schemas.xmlsoap.org/soap/envelope/"=>"soap",

          "http://www.w3.org/2001/XMLSchema"=>"xsd",
          "http://www.w3.org/2001/XMLSchema-instance"=>"xsi",
          "http://session.webservices.thefirm.uk"=>"intf"});


          You might have to pass an attribute to your soap method too
          depending on how strict the doc literal server is.

          something like

          my $soapmethod=SOAP::Data->name($method)
          ->attr({xmlns => $namespace});
        • chris
          Thank you Graham - that worked perfectly. From: soaplite@yahoogroups.com [mailto:soaplite@yahoogroups.com] On Behalf Of Graham Irvine Sent: 15 October 2007
          Message 4 of 5 , Oct 17, 2007
          • 0 Attachment

            Thank you Graham - that worked perfectly.

             

            From: soaplite@yahoogroups.com [mailto:soaplite@yahoogroups.com] On Behalf Of Graham Irvine
            Sent: 15 October 2007 23:22
            To: oldfic4
            Cc: soaplite@yahoogroups.com
            Subject: Re: [soaplite] How do I add a namespace to the soap header

             

            oldfic4 wrote:

            > How do get soaplite to add the xmlns:intf ns to get the soap envelope
            > to look as below?
            >
            > <soap:Envelope xmlns:soap="
            href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/"
            > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            > xmlns:intf="http://session.webservices.thefirm.uk">
            >
            > Thanks
            >
            >
            >
            >

            something like this will do it.

            my $soap = SOAP::Lite->proxy($proxy);
            $soap->serializer->soapversion("1.2");
            $soap->serializer->namespaces({
            "http://schemas.xmlsoap.org/soap/envelope/"=>"soap",

            "http://www.w3.org/2001/XMLSchema"=>"xsd",
            "http://www.w3.org/2001/XMLSchema-instance"=>"xsi",
            "http://session.webservices.thefirm.uk"=>"intf"});

            You might have to pass an attribute to your soap method too
            depending on how strict the doc literal server is.

            something like

            my $soapmethod=SOAP::Data->name($method)
            ->attr({xmlns => $namespace});

          • Paul Gallagher
            Hi Chris. Yes, overridding the serializer is the trick. Example: #!/usr/bin/perl -w use strict; #NB: SOAP::serializer- register_ns requires 0.65 use SOAP::Lite
            Message 5 of 5 , Oct 17, 2007
            • 0 Attachment
              Hi Chris. Yes, overridding the serializer is the trick. Example:

              #!/usr/bin/perl -w
              use strict;

              #NB: SOAP::serializer->register_ns requires 0.65
              use SOAP::Lite 0.65 +trace => 'debug';

              my $soap = SOAP::Lite
              ->proxy( 'http://localhost/blah/DummyService' );

              my $serializer = $soap->serializer();
              $serializer->register_ns( 'http://session.webservices.thefirm.uk', 'intf' );

              my $som = $soap->test();

              ===> generates request:

              <?xml version="1.0" encoding="UTF-8"?>
              <soap:Envelope xmlns:intf="http://session.webservices.thefirm.uk"
              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><test xsi:nil="true" /></soap:Body></soap:Envelope>


              On 10/15/07, oldfic4 <chris@...> wrote:
              > How do get soaplite to add the xmlns:intf ns to get the soap envelope
              > to look as below?
              >
              > <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
              > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
              > xmlns:intf="http://session.webservices.thefirm.uk">
              >
              > Thanks
              >
              >
              >
              >
              >
              >
              > Yahoo! Groups Links
              >
              >
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.