You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-dev@ws.apache.org by "Liu, Hua (Maria)" <Hu...@xerox.com> on 2008/04/18 23:57:39 UTC

input element name was used as method name -- a question about wsdl and ResourceInspector.java

Hi,

 

I've asked the question in the user DL but got no response. So I'm
sending it to the dev DL for help.

 

I wrote a simple wsdl file for a membership service which has two
methods: "boolean register(String hostname)" and "void deRegister(String
hostname)". The wsdl file is attached at the end of the email. I noticed
that wsdl2java.bat uses the element name "hostname" defined in types
section as the java method name. I expected that the java method name
should be obtained from the operation def in the binding or portType
section.

 

Then I looked into the source code, and found out in
ResourceInspector.java, at line 329 "method.setName(getInputName(op));",
it uses the input message part element name as the method name. It
confused me a lot.

 

I'm not a wsdl expert, and just started learning WSDL and Muse. Maybe
there is something wrong with my wsdl file or I misunderstood how
wsdl2java generated the server side code.

 

Would someone on the DL please help me with this problem?

 

Thanks,

Hua

 

 

 

The wsdl file:

 

<?xml version="1.0" encoding="utf-8"?>

<wsdl:definitions name="Membership"
targetNamespace="http://ws.disco.xerox.com/Membership"

                  xmlns:tns="http://ws.disco.xerox.com/Membership"

                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"

 
xmlns:wsdl-soap="http://schemas.xmlsoap.org/wsdl/soap/"

                  xmlns:wsa="http://www.w3.org/2005/08/addressing">

  <wsdl:types>

    <xsd:schema elementFormDefault="qualified"
targetNamespace="http://ws.disco.xerox.com/Membership">

      <xsd:element name="Hostname" type="xsd:string" />

      <xsd:element name="OperationResult" type="xsd:boolean" />

    </xsd:schema>

  </wsdl:types>

 

  <wsdl:message name="RegisterInputMessage">

    <wsdl:part name="parameter" element="tns:Hostname" />

  </wsdl:message>

  <wsdl:message name="RegisterOutputMessage">

    <wsdl:part name="result" element="tns:OperationResult" />

  </wsdl:message>

  <wsdl:message name="DeregisterInputMessage">

    <wsdl:part name="parameter" element="tns:Hostname" />

  </wsdl:message>

  

  <wsdl:portType name="MembershipPortType">

    <wsdl:operation name="Register">

      <wsdl:input
wsa:Action="http://ws.disco.xerox.com/Membership/RegisterParameters"
message="tns:RegisterInputMessage"/>

      <wsdl:output
wsa:Action="http://ws.disco.xerox.com/Membership/RegisterResponse"
message="tns:RegisterOutputMessage"/>

    </wsdl:operation>

    <wsdl:operation name="Deregister">

      <wsdl:input
wsa:Action="http://ws.disco.xerox.com/Membership/DeregisterParameters"
message="tns:DeregisterInputMessage"/>

    </wsdl:operation>

  </wsdl:portType>

 

  <wsdl:binding name="MembershipBinding" type="tns:MembershipPortType">

    <wsdl-soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

 

    <wsdl:operation name="Register">

      <wsdl-soap:operation
soapAction="http://ws.disco.xerox.com/Membership/Register"/>

      <wsdl:input>

        <wsdl-soap:body use="literal" />

      </wsdl:input>

      <wsdl:output>

        <wsdl-soap:body use="literal" />

      </wsdl:output>

    </wsdl:operation>

 

    <wsdl:operation name="Deregister">

      <wsdl-soap:operation
soapAction="http://ws.disco.xerox.com/Membership/Deregister"/>

      <wsdl:input>

        <wsdl-soap:body use="literal" />

      </wsdl:input>

    </wsdl:operation>

  </wsdl:binding>

 

  <wsdl:service name="MembershipService">

    <wsdl:port name="MembershipPort" binding="tns:MembershipBinding">

      <wsdl-soap:address
location="http://ws.disco.xerox.com/Membership"/>

    </wsdl:port>

  </wsdl:service>

  

</wsdl:definitions>

 

The server side interface generated from the wsdl file:

 

package com.xerox.disco.ws.Membership;

 

 

public interface IMyCapability

{

    String PREFIX = "tns";

 

    String NAMESPACE_URI = "http://ws.disco.xerox.com/Membership";

 

    public void hostname() throws Exception;

 

}


RE: input element name was used as method name -- a question about wsdl and ResourceInspector.java

Posted by "Vinh Nguyen (vinguye2)" <vi...@cisco.com>.
Hi,
Your schema types and input/output messages have a problem.  Try this:
 
    <xsd:schema elementFormDefault="qualified"
targetNamespace="http://ws.disco.xerox.com/Membership">
      <xsd:element name="Hostname" type="xsd:string" />
      <xsd:element name="OperationResult" type="xsd:boolean" />
      <xsd:element name="RegisterInput">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element ref="Hostname"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="RegisterInputResponse">
       <xsd:complexType>
          <xsd:sequence>
            <xsd:element ref="OperationResult"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="DeregisterInput">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element ref="Hostname"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="RegisterInputMessage">
    <wsdl:part name="parameter" element="tns:RegisterInput" />
  </wsdl:message>
  <wsdl:message name="RegisterOutputMessage">
    <wsdl:part name="result" element="tns:RegisterInputResponse" />
  </wsdl:message>
  <wsdl:message name="DeregisterInputMessage">
    <wsdl:part name="parameter" element="tns:DeregisterInput" />
  </wsdl:message>

-Vinh

________________________________

From: Liu, Hua (Maria) [mailto:Hua.Liu@xerox.com] 
Sent: Friday, April 18, 2008 2:58 PM
To: muse-dev@ws.apache.org
Subject: input element name was used as method name -- a question about
wsdl and ResourceInspector.java



Hi,

 

I've asked the question in the user DL but got no response. So I'm
sending it to the dev DL for help.

 

I wrote a simple wsdl file for a membership service which has two
methods: "boolean register(String hostname)" and "void deRegister(String
hostname)". The wsdl file is attached at the end of the email. I noticed
that wsdl2java.bat uses the element name "hostname" defined in types
section as the java method name. I expected that the java method name
should be obtained from the operation def in the binding or portType
section.

 

Then I looked into the source code, and found out in
ResourceInspector.java, at line 329 "method.setName(getInputName(op));",
it uses the input message part element name as the method name. It
confused me a lot.

 

I'm not a wsdl expert, and just started learning WSDL and Muse. Maybe
there is something wrong with my wsdl file or I misunderstood how
wsdl2java generated the server side code.

 

Would someone on the DL please help me with this problem?

 

Thanks,

Hua

 

 

 

The wsdl file:

 

<?xml version="1.0" encoding="utf-8"?>

<wsdl:definitions name="Membership"
targetNamespace="http://ws.disco.xerox.com/Membership"

                  xmlns:tns="http://ws.disco.xerox.com/Membership"

                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"

                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"

 
xmlns:wsdl-soap="http://schemas.xmlsoap.org/wsdl/soap/"

                  xmlns:wsa="http://www.w3.org/2005/08/addressing">

  <wsdl:types>

    <xsd:schema elementFormDefault="qualified"
targetNamespace="http://ws.disco.xerox.com/Membership">

      <xsd:element name="Hostname" type="xsd:string" />

      <xsd:element name="OperationResult" type="xsd:boolean" />

    </xsd:schema>

  </wsdl:types>

 

  <wsdl:message name="RegisterInputMessage">

    <wsdl:part name="parameter" element="tns:Hostname" />

  </wsdl:message>

  <wsdl:message name="RegisterOutputMessage">

    <wsdl:part name="result" element="tns:OperationResult" />

  </wsdl:message>

  <wsdl:message name="DeregisterInputMessage">

    <wsdl:part name="parameter" element="tns:Hostname" />

  </wsdl:message>

  

  <wsdl:portType name="MembershipPortType">

    <wsdl:operation name="Register">

      <wsdl:input
wsa:Action="http://ws.disco.xerox.com/Membership/RegisterParameters"
message="tns:RegisterInputMessage"/>

      <wsdl:output
wsa:Action="http://ws.disco.xerox.com/Membership/RegisterResponse"
message="tns:RegisterOutputMessage"/>

    </wsdl:operation>

    <wsdl:operation name="Deregister">

      <wsdl:input
wsa:Action="http://ws.disco.xerox.com/Membership/DeregisterParameters"
message="tns:DeregisterInputMessage"/>

    </wsdl:operation>

  </wsdl:portType>

 

  <wsdl:binding name="MembershipBinding" type="tns:MembershipPortType">

    <wsdl-soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>

 

    <wsdl:operation name="Register">

      <wsdl-soap:operation
soapAction="http://ws.disco.xerox.com/Membership/Register"/>

      <wsdl:input>

        <wsdl-soap:body use="literal" />

      </wsdl:input>

      <wsdl:output>

        <wsdl-soap:body use="literal" />

      </wsdl:output>

    </wsdl:operation>

 

    <wsdl:operation name="Deregister">

      <wsdl-soap:operation
soapAction="http://ws.disco.xerox.com/Membership/Deregister"/>

      <wsdl:input>

        <wsdl-soap:body use="literal" />

      </wsdl:input>

    </wsdl:operation>

  </wsdl:binding>

 

  <wsdl:service name="MembershipService">

    <wsdl:port name="MembershipPort" binding="tns:MembershipBinding">

      <wsdl-soap:address
location="http://ws.disco.xerox.com/Membership"/>

    </wsdl:port>

  </wsdl:service>

  

</wsdl:definitions>

 

The server side interface generated from the wsdl file:

 

package com.xerox.disco.ws.Membership;

 

 

public interface IMyCapability

{

    String PREFIX = "tns";

 

    String NAMESPACE_URI = "http://ws.disco.xerox.com/Membership";

 

    public void hostname() throws Exception;

 

}