通过WSDL调用Web服务

时间:2013-12-30 22:01:12

标签: java android web-services wsdl

我一直在按照教程发布我已成功完成的网络服务

可以在此处找到wsdl - http://hotornot-hnwebservice.rhcloud.com/TomcatHotOrNot/messages?wsdl

WSDL如下所示;

<!--
 Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1-b03-. 
-->
<!--
 Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1-b03-. 
-->
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.hotornot.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://service.hotornot.com/" name="ExposedFunctionsService">
<types>
<xsd:schema>
<xsd:import namespace="http://service.hotornot.com/" schemaLocation="http://hotornot-hnwebservice.rhcloud.com:80/TomcatHotOrNot/messages?xsd=1"/>
</xsd:schema>
</types>
<message name="addMessage">
<part name="parameters" element="tns:addMessage"/>
</message>
<message name="addMessageResponse">
<part name="parameters" element="tns:addMessageResponse"/>
</message>
<portType name="ExposedFunctions">
<operation name="addMessage">
<input message="tns:addMessage"/>
<output message="tns:addMessageResponse"/>
</operation>
</portType>
<binding name="ExposedFunctionsPortBinding" type="tns:ExposedFunctions">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="addMessage">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="ExposedFunctionsService">
<port name="ExposedFunctionsPort" binding="tns:ExposedFunctionsPortBinding">
<soap:address location="http://hotornot-hnwebservice.rhcloud.com:80/TomcatHotOrNot/messages"/>
</port>
</service>
</definitions>

理想情况下,我想使用android来调用我的Web服务。我假设WSDL应该描述服务以指示如何调用Web服务。

任何人都可以帮助我如何从Android调用此Web服务?

由于

1 个答案:

答案 0 :(得分:0)

WSDL描述了服务,即其操作和结构。它还指定它是否可通过HTTP等。所有这些信息足以调用该服务。但是,您仍然需要对实际的服务调用进行编码。

阅读this tutorial,了解如何从android调用Web服务。