Topic
3 replies Latest Post - ‏2011-02-13T19:49:37Z by jojobojo
jojobojo
jojobojo
3 Posts
ACCEPTED ANSWER

Pinned topic WSDL shame -complex type issue with validation

‏2011-02-11T15:02:51Z |
Hi all,
been trying to work out why my wsdl schema doesnt validate, cannot solve it after hours, please help a damsel in distress?
Its something to do with namespace i think, I cant seent to correctly reference the element player_types ....

here is the wsdl

<?xml version='1.0' encoding='UTF-8'?>

<definitions name="userOps"
targetNamespace="urn:userOps"
xmlns:rugby_ns="urn:userOps"
xmlns:ms="http://test.com/ws/ms/userOps.wsdl"
xmlns:tns="http://test.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">

<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:hr="urn:userOps"
targetNamespace="urn:userOps"
elementFormDefault="qualified">

<xsd:element name="Address">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="address_one" minOccurs="0" maxOccurs="1" type="xsd:string"/>
<xsd:element name="town" minOccurs="0" maxOccurs="1" type="xsd:string"/>
<xsd:element name="county" minOccurs="0" maxOccurs="1" type="xsd:string"/>
<xsd:element name="postcode" minOccurs="1" maxOccurs="1" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="player_types">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="red" />
<xsd:enumeration value="blue" />
<xsd:enumeration value="green" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

<xsd:element name="Person">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="title" minOccurs="1" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Mr" />
<xsd:enumeration value="Mrs" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="first_name" minOccurs="1" maxOccurs="1" type="xsd:string"/>
<xsd:element name="last_name" minOccurs="1" maxOccurs="1" type="xsd:string"/>
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="M" />
<xsd:enumeration value="F" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="date_of_birth" minOccurs="1" maxOccurs="1" type="xsd:date"/>
<xsd:element name="telephone" minOccurs="0" maxOccurs="1" type="xsd:string"/>
<xsd:element name="mobile" minOccurs="0" maxOccurs="1" type="xsd:string"/>
<xsd:element name="email" minOccurs="0" maxOccurs="1" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="authenticateResult">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="player_type" minOccurs="0" maxOccurs="1" type="hr:player_types"/><!-- ahhhh this doesnt resolve -->
<xsd:element name="validated" minOccurs="1" maxOccurs="1" type="xsd:boolean"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>
</wsdl:types>

<message name="authenticate">
<part name="member_username" type="xsd:string"/>
<part name="member_password" type="xsd:string"/>
</message>
<message name="authenticateResponse">
<part name="authenticateReturn" element="rugby_ns:authenticateResult"/>
</message>

<portType name="memberServicePortType">
<operation name="authenticate">
<documentation>
authenticate method
</documentation>
<input message="rugby_ns:authenticate"/>
<output message="rugby_ns:authenticateResponse"/>
</operation>
</portType>
<binding name="memberServiceBinding" type="rugby_ns:memberServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="authenticate">
<soap:operation soapAction="urn:memberServiceAction"/>
<input>
<soap:body namespace="urn:userOps" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:userOps" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>

</binding>
<service name="memberServiceService">
<port name="memberServicePort" binding="rugby_ns:memberServiceBinding">
<soap:address location="/ws/ms/ms.php"/>
</port>
</service>

</definitions>
Updated on 2011-02-13T19:49:37Z at 2011-02-13T19:49:37Z by jojobojo
  • SystemAdmin
    SystemAdmin
    1391 Posts
    ACCEPTED ANSWER

    Re: WSDL shame -complex type issue with validation

    ‏2011-02-12T14:07:22Z  in response to jojobojo
    Its something to do with namespace i think, I cant seent to correctly reference the element player_types ....
    Namespace, sure, is always relevant. But the problem, as far as the schema embedded in wsdl:types is concerned, is something else.

    [1] First, you've to correct a major missing open tag of some element named probably "gender" or something similar. There is a missing open tag <xsd:element> here.
    
    <xsd:element name=
    "gender">   <!-- missing --> <xsd:simpleType> <xsd:restriction base=
    "xsd:string"> <xsd:enumeration value=
    "M" /> <xsd:enumeration value=
    "F" /> </xsd:restriction> </xsd:simpleType> </xsd:element>
    

    [2] Now the central problem. You're making xsd:element named "play_type" referring to a datatype of the target namespace. But, you construction of the type is actually start with xsd:element. and that becomes absolutely incorrect. This is how it should appear.
    
    <!-- <xsd:element name=
    "player_types"> --> <!-- <xsd:simpleType> --> <xsd:simpleType name=
    "player_types"> <xsd:restriction base=
    "xsd:string"> <xsd:enumeration value=
    "red" /> <xsd:enumeration value=
    "blue" /> <xsd:enumeration value=
    "green" /> </xsd:restriction> </xsd:simpleType> <!-- </xsd:element> -->
    
    • jojobojo
      jojobojo
      3 Posts
      ACCEPTED ANSWER

      Re: WSDL shame -complex type issue with validation

      ‏2011-02-13T19:48:26Z  in response to SystemAdmin
      Brillian thanks tsuji. The reason the "gender" was missing is becuase i was trying to cut out some noise to make the post smaller and must have left that there by mistake - your solution re the player_type was spot on and solved my issue, many thanks to you.
  • jojobojo
    jojobojo
    3 Posts
    ACCEPTED ANSWER

    Re: WSDL shame -complex type issue with validation

    ‏2011-02-13T19:49:37Z  in response to jojobojo
    excellent and accurate solution provided by tsuji, very much appreciated