有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java通过WSDL调用web服务

我一直在遵循一个教程来发布一个我已经成功完成的web服务

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>

理想情况下,我希望使用安卓来调用我的web服务。我的假设是,WSDL应该描述服务,以指示如何调用web服务

有谁能帮我从安卓系统调用这个web服务吗

谢谢


共 (1) 个答案

  1. # 1 楼答案

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

    阅读this tutorial关于如何从android调用web服务