我的网络服务中有一个简单的 public boolean isAlive()
服务。
我在 WSDL 中定义了它:
<wsdl:types>
<xsd:element name="isAliveResponse" type="xsd:boolean">
</xsd:element>
</wsdl:types>
<wsdl:message name="isAliveResponse">
<wsdl:part element="ns:isAliveResponse" name="parameters"/>
</wsdl:message>
<wsdl:portType name="myService">
<wsdl:operation name="isAlive">
<wsdl:output message="ns:isAliveResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="myServiceSOAP" type="ns:myService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="isAlive">
<soap:operation soapAction="http://myServiceURL/isAlive" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
当我生成服务框架时,会生成方法,但不会在客户端 stub 中生成。 WSDL 有问题吗?即使该方法没有参数,我是否应该放置 wsdl:input (我没有放置整个 WSDL,但所有其他带有“请求”参数的方法都生成良好)?如果我必须输入 wsdl:input 它的消息是什么?
编辑:在 Eclipse 下验证 WSDL 后,我收到警告WS-I:(BP2208) wsdl:操作不是请求/响应或单向操作
搜索后我在这里找到了描述:http://www.ws-i.org/Testing/Tools/2005/01/BP11_TAD_1-1.htm#BP2208 (看起来 anchor 不起作用)所以我猜错误可能是缺少 wsdl:input。
最佳答案
正如我在编辑中所说,问题是缺少 wsdl:input。通过添加
<wsdl:input message="ns:isAliveRequest" />
和
<wsdl:message name="isAliveRequest"></wsdl:message>
然后我原来的问题就解决了...结论,我应该在询问之前自己进行更多搜索:(
关于java - 轴2 WSDL2Java : missing no-arg operation in generated stub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/317362/