从wsdl android获取soap动作和命名空间

时间:2014-03-06 16:16:53

标签: android web-services soap wsdl

我正在尝试使用我创建的网络服务,这是wsdl:(I tried namespace http://serverip:9999/POIWebServer/POIWebServiceImplService or http://serverip:9999/POIWebServiceImplService and soap action "" but doesn't work

 <?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. --><definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://server/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server/" name="POIWebServiceImplService">
<types>
<xsd:schema>
<xsd:import namespace="http://server/" schemaLocation="http://localhost:9999/POIWebServer/?xsd=1"></xsd:import>
</xsd:schema>
</types>
<message name="registerUser">
<part name="parameters" element="tns:registerUser"></part>
</message>
<message name="registerUserResponse">
<part name="parameters" element="tns:registerUserResponse"></part>
</message>
<message name="setMonitorData">
<part name="parameters" element="tns:setMonitorData"></part>
</message>
<message name="setMonitorDataResponse">
<part name="parameters" element="tns:setMonitorDataResponse"></part>
</message>
<message name="getMapData">
<part name="parameters" element="tns:getMapData"></part>
</message>
<message name="getMapDataResponse">
<part name="parameters" element="tns:getMapDataResponse"></part>
</message>
<portType name="POIWebService">
<operation name="registerUser">
<input wsam:Action="http://server/POIWebService/registerUserRequest" message="tns:registerUser"></input>
<output wsam:Action="http://server/POIWebService/registerUserResponse" message="tns:registerUserResponse"></output>
</operation>
<operation name="setMonitorData">
<input wsam:Action="http://server/POIWebService/setMonitorDataRequest" message="tns:setMonitorData"></input>
<output wsam:Action="http://server/POIWebService/setMonitorDataResponse" message="tns:setMonitorDataResponse"></output>
</operation>
<operation name="getMapData">
<input wsam:Action="http://server/POIWebService/getMapDataRequest" message="tns:getMapData"></input>
<output wsam:Action="http://server/POIWebService/getMapDataResponse" message="tns:getMapDataResponse"></output>
</operation>
</portType>
<binding name="POIWebServiceImplPortBinding" type="tns:POIWebService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"></soap:binding>
<operation name="registerUser">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
<operation name="setMonitorData">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
<operation name="getMapData">
<soap:operation soapAction=""></soap:operation>
<input>
<soap:body use="literal"></soap:body>
</input>
<output>
<soap:body use="literal"></soap:body>
</output>
</operation>
</binding>
<service name="POIWebServiceImplService">
<port name="POIWebServiceImplPort" binding="tns:POIWebServiceImplPortBinding">
<soap:address location="http://localhost:9999/POIWebServer/"></soap:address>
</port>
</service>
</definitions>

这是访问网络服务的代码

Thread networkThread = new Thread(){
               @Override
               public void run(){
                   try {
                       SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
                       SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                       envelope.setOutputSoapObject(request);
                       String temp=username+"#"+password1+"#"+password2;
                       request.addProperty("propeties",temp); 
                       HttpTransportSE ht = new HttpTransportSE(URL);
                       ht.call(SOAP_ACTION, envelope);
                       final SoapPrimitive response = (SoapPrimitive)envelope.getResponse();
                       final String responseStr = response.toString();
                       myTextView.setText(responseStr);
                   } catch(Exception e){
                       e.printStackTrace();
                   }
               }
           };

0 个答案:

没有答案