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

namespace troubles while using .wsdl

Expand Messages
  • Alexandre Maret
    hello I m having troubles using a .wsdl file. the solution is probably very straightforward, however I can t fix it... The client request (see code below):
    Message 1 of 4 , Jul 24 3:33 AM
    • 0 Attachment
      hello

      I'm having troubles using a .wsdl file. the solution is probably very
      straightforward, however I can't fix it...

      The client request (see code below):

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope
      xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/1999/XMLSchema">

      <SOAP-ENV:Body>
      <namesp1:AddUser xmlns:namesp1="urn:AccessControl">
      <account xsi:type="myTypes:UserAccount">
      <username xsi:type="xsd:string">abc</username>
      <password xsi:type="xsd:string">def</password>
      </account>
      </namesp1:AddUser>
      </SOAP-ENV:Body>

      </SOAP-ENV:Envelope>

      The problem is that the "myTypes" namespace isn't defined in the request.
      The deserializer thus fails on server side. How do I define the "myTypes"
      namespace on the client side... ? (BTW, is this the way ppl are supposed
      to use .wsdl files ?)

      Also... should the "account" element be namespace-prefixed ?

      thanks in advance

      alex

      --------------------------

      the error:

      <faultstring xsi:type="xsd:string">Application failed during request
      deserialization: Unresolved prefix 'myTypes' for attribute value
      'myTypes:UserAccount'</faultstring>

      client code:

      my($service) = SOAP::Lite->service('http://example.com/accounts.wsdl');
      my($req) = {
      "username" => $username,
      "password" => $password
      };
      my($res) = $service->AddUser($req);


      server code:

      sub AddUser {
      my($class, $req) = @_;
      play with $req->{"username"} and $req->{"password"};
      }



      relevant sections of the wsdl definition:

      types:

      <xsd:complexType name="UserAccount">
      <xsd:all>
      <xsd:element name="username" type="xsd:string"/>
      <xsd:element name="password" type="xsd:string"/>
      </xsd:all>
      </xsd:complexType>

      messages:

      <message name="AddUserRequest">
      <part name="account" type="myTypes:UserAccount"/>
      </message>
      <message name="AddUserResponse">
      <part name="status" type="xsd:string"/>
      </message>

      obvious operation:

      <operation name="AddUser">
      <input message="AddUserRequest"/>
      <output message="AddUserResponse"/>
      </operation>
    • Paul Kulchenko
      Hi, Alexandre! myTypes definitions should be included in the same part element:
      Message 2 of 4 , Jul 24 8:03 AM
      • 0 Attachment
        Hi, Alexandre!

        myTypes definitions should be included in the same part element:

        <message name="AddUserRequest">
        <part name="account" type="myTypes:UserAccount"
        xmlns:myTypes="....."/>
        </message>

        Next version will probably pick it up from outer elements also.

        Best wishes, Paul.

        --- Alexandre Maret <amaret@...> wrote:
        > hello
        >
        > I'm having troubles using a .wsdl file. the solution is probably
        > very
        > straightforward, however I can't fix it...
        >
        > The client request (see code below):
        >
        > <?xml version="1.0" encoding="UTF-8"?>
        > <SOAP-ENV:Envelope
        > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        >
        > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
        >
        > <SOAP-ENV:Body>
        > <namesp1:AddUser xmlns:namesp1="urn:AccessControl">
        > <account xsi:type="myTypes:UserAccount">
        > <username xsi:type="xsd:string">abc</username>
        > <password xsi:type="xsd:string">def</password>
        > </account>
        > </namesp1:AddUser>
        > </SOAP-ENV:Body>
        >
        > </SOAP-ENV:Envelope>
        >
        > The problem is that the "myTypes" namespace isn't defined in the
        > request.
        > The deserializer thus fails on server side. How do I define the
        > "myTypes"
        > namespace on the client side... ? (BTW, is this the way ppl are
        > supposed
        > to use .wsdl files ?)
        >
        > Also... should the "account" element be namespace-prefixed ?
        >
        > thanks in advance
        >
        > alex
        >
        > --------------------------
        >
        > the error:
        >
        > <faultstring xsi:type="xsd:string">Application failed during
        > request
        > deserialization: Unresolved prefix 'myTypes' for attribute value
        > 'myTypes:UserAccount'</faultstring>
        >
        > client code:
        >
        > my($service) =
        > SOAP::Lite->service('http://example.com/accounts.wsdl');
        > my($req) = {
        > "username" => $username,
        > "password" => $password
        > };
        > my($res) = $service->AddUser($req);
        >
        >
        > server code:
        >
        > sub AddUser {
        > my($class, $req) = @_;
        > play with $req->{"username"} and $req->{"password"};
        > }
        >
        >
        >
        > relevant sections of the wsdl definition:
        >
        > types:
        >
        > <xsd:complexType name="UserAccount">
        > <xsd:all>
        > <xsd:element name="username" type="xsd:string"/>
        > <xsd:element name="password" type="xsd:string"/>
        > </xsd:all>
        > </xsd:complexType>
        >
        > messages:
        >
        > <message name="AddUserRequest">
        > <part name="account" type="myTypes:UserAccount"/>
        > </message>
        > <message name="AddUserResponse">
        > <part name="status" type="xsd:string"/>
        > </message>
        >
        > obvious operation:
        >
        > <operation name="AddUser">
        > <input message="AddUserRequest"/>
        > <output message="AddUserResponse"/>
        > </operation>
        >
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Make international calls for as low as $.04/minute with Yahoo! Messenger
        http://phonecard.yahoo.com/
      • Alexandre Maret
        thanks paul, it works by modifying the wsdl the way you recommend. but I don t think it s the way it should be done, since this is not very standard . Have a
        Message 3 of 4 , Jul 25 1:16 AM
        • 0 Attachment
          thanks paul, it works by modifying the wsdl the way you recommend. but I
          don't think it's the way it should be done, since this is not very
          "standard".

          Have a look at http://www.w3.org/TR/wsdl#_wsdl for a valid example.

          It can be argued that since the <message/part> tags are enclosed in a
          <definition> tag defining all the needed namespaces (myTypes), it should
          be useless to redefine it one element below...

          what do you think ?

          I took a look at wsdl files from ibm's WebServicesToolkit and I don't see
          any <part> element having anything else but name and type attributes...

          alex



          On Tue, 24 Jul 2001, Paul Kulchenko wrote:

          > Hi, Alexandre!
          >
          > myTypes definitions should be included in the same part element:
          >
          > <message name="AddUserRequest">
          > <part name="account" type="myTypes:UserAccount"
          > xmlns:myTypes="....."/>
          > </message>
          >
          > Next version will probably pick it up from outer elements also.
          >
          > Best wishes, Paul.
          >
          > --- Alexandre Maret <amaret@...> wrote:
          > >
          > > messages:
          > >
          > > <message name="AddUserRequest">
          > > <part name="account" type="myTypes:UserAccount"/>
          > > </message>
          > > <message name="AddUserResponse">
          > > <part name="status" type="xsd:string"/>
          > > </message>
        • Paul Kulchenko
          Hi, Alexandre! ... It s not :). ... I agree with you. It will be done this way. Thank you. Best wishes, Paul. ...
          Message 4 of 4 , Jul 25 8:09 AM
          • 0 Attachment
            Hi, Alexandre!

            > thanks paul, it works by modifying the wsdl the way you recommend.
            > but I
            > don't think it's the way it should be done, since this is not very
            > "standard".
            It's not :).

            > <definition> tag defining all the needed namespaces (myTypes), it
            > should be useless to redefine it one element below...
            > what do you think ?
            I agree with you. It will be done this way. Thank you.

            Best wishes, Paul.

            --- Alexandre Maret <amaret@...> wrote:
            > thanks paul, it works by modifying the wsdl the way you recommend.
            > but I
            > don't think it's the way it should be done, since this is not very
            > "standard".
            >
            > Have a look at http://www.w3.org/TR/wsdl#_wsdl for a valid example.
            >
            > It can be argued that since the <message/part> tags are enclosed in
            > a
            > <definition> tag defining all the needed namespaces (myTypes), it
            > should
            > be useless to redefine it one element below...
            >
            > what do you think ?
            >
            > I took a look at wsdl files from ibm's WebServicesToolkit and I
            > don't see
            > any <part> element having anything else but name and type
            > attributes...
            >
            > alex
            >
            >
            >
            > On Tue, 24 Jul 2001, Paul Kulchenko wrote:
            >
            > > Hi, Alexandre!
            > >
            > > myTypes definitions should be included in the same part element:
            > >
            > > <message name="AddUserRequest">
            > > <part name="account" type="myTypes:UserAccount"
            > > xmlns:myTypes="....."/>
            > > </message>
            > >
            > > Next version will probably pick it up from outer elements also.
            > >
            > > Best wishes, Paul.
            > >
            > > --- Alexandre Maret <amaret@...> wrote:
            > > >
            > > > messages:
            > > >
            > > > <message name="AddUserRequest">
            > > > <part name="account" type="myTypes:UserAccount"/>
            > > > </message>
            > > > <message name="AddUserResponse">
            > > > <part name="status" type="xsd:string"/>
            > > > </message>
            >
            >
            > ------------------------ Yahoo! Groups Sponsor
            >
            > To unsubscribe from this group, send an email to:
            > soaplite-unsubscribe@yahoogroups.com
            >
            >
            >
            > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            >
            >


            __________________________________________________
            Do You Yahoo!?
            Make international calls for as low as $.04/minute with Yahoo! Messenger
            http://phonecard.yahoo.com/
          Your message has been successfully submitted and would be delivered to recipients shortly.