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

namespace problems with WSDL file

Expand Messages
  • Sven Paulus
    Hi, I m currently trying to use a SOAP::Lite based server (mod_perl) with a SOAP::Lite based client. However the server complains about namespace problems:
    Message 1 of 1 , Feb 4, 2003
    • 0 Attachment

      I'm currently trying to use a SOAP::Lite based server (mod_perl) with a
      SOAP::Lite based client. However the server complains about namespace

      SOAP call failed: Application failed during request deserialization:
      Unresolved prefix 'tns' for attribute value 'tns:RecipientList'

      This seems to be caused by a malformed message by the client.

      My client looks like this (further explanation at the bottom of this mail):

      #! /usr/bin/perl

      use SOAP::Lite trace => qw(debug);
      if (!eval { $soap = SOAP::Lite
      -> service("file:./c.wsdl")
      -> on_fault( sub {
      print "SOAP call failed: ".
      (ref $res ? $res->faultstring : $soap->transport->status)."\n";
      exit 1;
      }); 1 }) {
      print "SOAP call failed: couln't fetch WSDL\n";
      exit 1;
      @rec=("abc\@def", "xyz\@ghi");

      $result = $soap->sendMessage($content,$sender,\@rec);
      print "Return: rcode=".$re{"returncode"}.
      " errmsg=".$re{"errormessage"}.
      " id=".$re{"msgid"}."\n";
      if ($re{"returncode"} == 0) {
      print "Success!\n";
      } else {
      print "Failure!\n";

      And this is my WSDL file:

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:types xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
      <xsd:schema targetNamespace="urn:mailmessage">
      <xsd:complexType name="RecipientList">
      <xsd:restriction base="SOAP-ENC:Array">
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:string"/>
      <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/>
      <xsd:complexType name="sendMessageResult">
      <xsd:element name="returncode" type="xsd:integer"/>
      <xsd:element name="errormessage" type="xsd:string"/>
      <xsd:element name="msgid" type="xsd:string"/>
      <message name="sendMessageSoapOut">
      <part name="result" type="tns:sendMessageResult"/>
      <message name="sendMessageSoapIn">
      <part name="content" type="xsd:string"/>
      <part name="sender" type="xsd:string"/>
      <part name="recipients" type="tns:RecipientList"/>

      <portType name="mailmessagePortType">
      <operation name="sendMessage">
      <input message="tns:sendMessageSoapIn"/>
      <output message="tns:sendMessageSoapOut"/>

      <binding name="mailmessageBinding" type="tns:mailmessagePortType">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="sendMessage">
      <soap:operation style="rpc" soapAction="urn:mailmessage#sendMessage"/>
      <soap:body namespace="urn:mailmessage" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      <soap:body namespace="urn:mailmessage" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>

      <service name="mailmessage">
      <port name="mailmessagePort" binding="tns:mailmessageBinding">
      <soap:address location=""/>

      When I'm issueing a request, the XML block looks like this (reformatted for
      better readability):

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <namesp1:sendMessage xmlns:namesp1="urn:mailmessage">
      <content xsi:type="xsd:string">blabla</content>
      <sender xsi:type="xsd:string">test123@bla</sender>
      <recipients xsi:type="tns:RecipientList" SOAP-ENC:arrayType="xsd:string[2]">
      <item xsi:type="xsd:string">abc@def</item>
      <item xsi:type="xsd:string">xyz@ghi</item>

      The problem is the "tns:RecipientList" type attribute to the recipients
      element. xmlns:tns is not declared in the SOAP Envelope. Is there a way get
      SOAP::Lite to add all the namespace declarations given in the WSDL
      definitions tag? A xlmns:tns="urn:mailmessage" would help, wouldn't it?

      One way to fix the problem is this patch to SOAP::Lite:

      -- /tmp/Lite.pm 2002-04-16 06:42:48.000000000 +0200
      +++ /usr/share/perl5/SOAP/Lite.pm 2003-02-04 21:08:24.000000000 +0100
      @@ -2415,7 +2415,7 @@
      my $inputmessage = SOAP::Utils::disqualify($_->input->message);
      foreach ($s->message) {
      next unless $_->name eq $inputmessage;
      - @parts = $_->part;
      + @parts = SOAP::Utils::disqualify($_->part);

      This removes the reference to "tns" from the type attribute.
      But I guess this is solving the problem the wrong way (removing the
      namespace instead of adding the declaration). I didn't get far looking for
      the list of namespaces in SOAP/Lite.pm, somehow these tags aren't imported
      by the deserializer.

      So, can anybody help me? Is my code wrong? My WSDL file? Or is this one of
      the problems caused by the limited WSDL support in SOAP::Lite?

      Thanks a lot!

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