请问XXXXXstub怎么使用?

jiangjian0427 2011-02-17 06:27:30
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>
...全文
181 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 wdz567 的回复:]

Java code

HelloWorldService service=new HelloWorldServiceLocator();
HelloWorldServicePortType stype=service.getHelloWorldServiceHttpPort(url);


你看看有这些东东没有!
stub 这东东是不直接调用的!
貌似如此
[/Quote]

呵呵
酒剑仙 2011-02-18
  • 打赏
  • 举报
回复

HelloWorldService service=new HelloWorldServiceLocator();
HelloWorldServicePortType stype=service.getHelloWorldServiceHttpPort(url);

你看看有这些东东没有!
stub 这东东是不直接调用的!
貌似如此
jiangjian0427 2011-02-18
  • 打赏
  • 举报
回复
补充说明一下把 ,wsdl2java生成的stub中的方法怎么参数返回值都是interface? 这种方法怎么调用?怎么传参数
jiangjian0427 2011-02-18
  • 打赏
  • 举报
回复
没有HelloWorldService这个东西,只有下面4个java:
GetGreetingsDocument.java
GetGreetingsResponseDocument.java
HelloWorldServiceCallbackHandler.java
HelloWorldServiceStub.java
jackey_ctdw 2011-02-17
  • 打赏
  • 举报
回复
没看明白

67,550

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧