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

2731RE: [soaplite] ??? Receiving freeform SOAP message with no namesp ace

Expand Messages
  • Byrne Reese
    Jun 19, 2003
    • 0 Attachment
      From what I can tell, your customer may not be sending you valid SOAP/XML. In the XML at the bottom of this message, the <POS> elements, because they are not namespace qualified, will inherit the namespace of their parent. As a result, SOAP::Lite will try to either a) interpret them as SOAP elements, which they are not, or find no method call.
       
      I know it is difficult to make others change how they implement things, but I suggest you recommend to them that they use a SOAP toolkit so these issues are more easily avoided.
       
      To be proper SOAP, you would need XML that looks like this:
       
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENV="
      http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:SOAP-ENC="
      http://schemas.xmlsoap.org/soap/
      encoding/"
      xmlns:xsi="
      http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="
      http://www.w3.org/2001/XMLSchema">
        <SOAP-ENV:Header>
          <key xsi:type="xsd:int">123456</key>
        </SOAP-ENV:Header>
        <SOAP-ENV:Body>
          <ns:POS xmlns:ns="urn:Foo"></ns:POS>
        </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      Or this:
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENV="
      http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:SOAP-ENC="
      http://schemas.xmlsoap.org/soap/
      encoding/"
      xmlns:xsi="
      http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="
      http://www.w3.org/2001/XMLSchema">
        <SOAP-ENV:Header>
          <key xsi:type="xsd:int">123456</key>
        </SOAP-ENV:Header>
        <SOAP-ENV:Body>
          <POS xmlns="urn:Foo"></POS>
        </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      -----Original Message-----
      From: ggib23 [mailto:ggib23@...]
      Sent: Wednesday, June 18, 2003 11:02 AM
      To: soaplite@yahoogroups.com
      Subject: [soaplite] ??? Receiving freeform SOAP message with no namespace

      I'm working with a company who is sending freeform Soap messages.
      They will not be including any Soap namespace or methods like this:

      <namesp1:testMethod xmlns:namesp1="Gtest">
           <c-gensym5 xsi:type="xsd:string">

      inside the SOAP-ENV:BODY tag, so I am trying to figure out
      how to use Soap::Lite to deserialize the raw xml into valid
      Soap Objects, so that I can process the message.


      I can read the raw xml from STDIN, but when I try to
      Deserialize it, I get a uri error in the Soap::lite
      package.  Is this possible to do with Soap::Lite, or
      am I just going to have to build my own xml programs
      to create the SOAP response to send back to my client?
      Do you see anything( or several things) I am doing
      wrong?

      Here is my sample server code:
      #!/hildev/bin/perl -w

      use SOAP::Transport::HTTP;
      use Debug;

      Debug::Init( "Gdebug" );
      Debug::Suffix( ".dbg" );
      Debug::On();

      #read the entire SOAP, XML document in at one time
      my $input = readline(*STDIN);
      Debug::Print( "My readline = $input \n");

      my $envelope = SOAP::Deserializer($input);
      my $hdr = $envelope->headerof("//key");
      Debug::Print( "$hdr->name() = NAME");


      **************************************************************
      Here is my client code:
      ********************************************************
      #!/hildev/bin/perl -w

      use strict;
      use Net::Telnet;
      my $data = "";

      while( <STDIN> ) {
        $data = $_;

        my $conlength = length( $data );

        my $con = new Net::Telnet;

        $con->open(Host => $host,
                 Port => $port);

        $con->print("POST $url HTTP/1.0");
        $con->print("Content-Length: $conlength\n");
        $con->print("$data\n");
        my $cnt = $con->print_length;
        print "I SENT $cnt Btyes Across\n";
        $con->print("");

        while(!$con->eof) {
           my $line = $con->getline;
           print "$line\n";
        }

      }

      **********************************************************************
      ****************************************
      Here is the XML that was sent:  The actual file contains no new-line
      or carriage returns in the document, just 1 line.......
      *******************************************************
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/
      encoding/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <SOAP-ENV:Header>
      <key xsi:type="xsd:int">123456</key></SOAP-ENV:Header>
      <SOAP-ENV:Body><POS></POS></SOAP-ENV:Body>
      </SOAP-ENV:Envelope>





      To unsubscribe from this group, send an email to:
      soaplite-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.