1, 先生成java代码:
wsdl2java -d xmlbeans -uri C:\work\Helloworld.wsdl
有一个 HelloWorldServiceStub ,方法
public  helloworld.GetGreetingsResponseDocument getGreetings(
helloworld.GetGreetingsDocument getGreetings0)
 throws java.rmi.RemoteException
{
....
....
}
2 我看了一下参数和返回值helloworld.GetGreetingsResponseDocument ,helloworld.GetGreetingsDocument都是interface
3我想做一个HelloClient调用stub的 getGreetings  ,怎么做?附上wsdl:
<wsdl:definitions targetNamespace="http://helloworld"
xmlns:tns="http://helloworld" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    name="helloworld">
    <wsdl:types>
        <schema elementFormDefault="qualified" targetNamespace="http://helloworld"
         xmlns="http://www.w3.org/2001/XMLSchema">
            <element name="getGreetings">
                <complexType>
                    <sequence>
                        <element name="name" type="xsd:string"/>
                    </sequence>
                </complexType>
            </element>            <element name="getGreetingsResponse">
                <complexType>
                    <sequence>
                        <element name="getGreetingsReturn" type="xsd:string"/>
                    </sequence>
                </complexType>
            </element>
          
        </schema>
    </wsdl:types>
    <wsdl:message name="getGreetingsRequest">
        <wsdl:part element="tns:getGreetings" name="parameters"/>
    </wsdl:message>
    <wsdl:message name="getGreetingsResponse">
        <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
    </wsdl:message>    <wsdl:portType name="HelloWorld">
        <wsdl:operation name="getGreetings">
            <wsdl:input message="tns:getGreetingsRequest" name="getGreetingsRequest"/>
            <wsdl:output message="tns:getGreetingsResponse" name="getGreetingsResponse"/>
        </wsdl:operation>
    </wsdl:portType>    <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
        <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="getGreetings">
            <wsdlsoap:operation soapAction=""/>
            <wsdl:input name="getGreetingsRequest">
                <wsdlsoap:body use="literal"/>
            </wsdl:input>
            <wsdl:output name="getGreetingsResponse">
                <wsdlsoap:body use="literal"/>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>    <wsdl:service name="HelloWorldService">
        <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldSoapPort">
            <wsdlsoap:address location="http://localhost:8085/HelloWorldService"/>
        </wsdl:port>
    </wsdl:service></wsdl:definitions>

解决方案 »

  1.   

    补充说明一下把  ,wsdl2java生成的stub中的方法怎么参数返回值都是interface?   这种方法怎么调用?怎么传参数
      

  2.   


    HelloWorldService service=new HelloWorldServiceLocator();
    HelloWorldServicePortType stype=service.getHelloWorldServiceHttpPort(url);你看看有这些东东没有!
    stub 这东东是不直接调用的!
    貌似如此
      

  3.   

    没有HelloWorldService这个东西,只有下面4个java:
    GetGreetingsDocument.java
    GetGreetingsResponseDocument.java
    HelloWorldServiceCallbackHandler.java
    HelloWorldServiceStub.java