Problems with replicating a wsdl with nusoap.

  • Anonymous

    Anonymous - 2011-01-21


    I'm writing a nusoap web service server and I need to replicate this structure (this is only an example but the original is very similar to this. It was copied from a wsdl).

    <element name="Users">
            <sequence maxOccurs="unbounded">
                <element name="User">
                        <choice minOccurs="0" maxOccurs="unbounded">
                            <element name="Admin">
                                    <attribute name="LastChangedItem" type="string" use="required"/>
                            <element name="Normal">
                                    <attribute name="LastLogin" type="dateTime" use="required"/>
                                    <attribute name="LastViewedItem" type="string" use="required"/>
                        <attribute name="ID" type="string" use="required"/>
                        <attribute name="Username" type="string" use="required"/>

    I've tried with addComplexType but i can never get the same result.
    I made a User type with elements ID, and Username the result was:

    <xsd:complexType name="User">
        <xsd:element name="ID" type="string"/>
        <xsd:element name="Username" type="string"/>

    It's kinda like the original but i realy want this to look like it.
    I'm also not sure how to add nested types Admin and Normal.

    Is this even possible with nusoap?

    Thank you for your help.

  • Scott Nichol

    Scott Nichol - 2011-01-21

    If you have existing WSDL, my suggestion is use it directly rather than trying to replicate it with NuSOAP calls.  You will note that the nusoap_server constructor takes an optional parameter that specifies a file or URL with WSDL in it:

    * constructor
        * the optional parameter is a path to a WSDL file that you'd like to bind the server instance to.
        * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
    * @access   public
    function nusoap_server($wsdl=false){

    When you do that, all the work is done for you and you do not have to use addComplexType or register calls at all.


Log in to post a comment.