android访问本地java写的webservice不成功
如题:android中配置是:String NAMESPACE = "http://ws.my.com/";
String wsdl = "http://10.0.0.2:8080/King/CalculatorPort";
String methodName = "multiply";
String soapaction = NAMESPACE + methodName;
SoapObject rpc = new SoapObject(NAMESPACE, methodName);
System.out.println("rpc" + rpc);
rpc.addProperty("a", 2);
rpc.addProperty("b", 5);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER10);
envelope.bodyOut = rpc;
envelope.dotNet = false;
envelope.setOutputSoapObject(rpc);
if(!envelope.dotNet)
{
wsdl = wsdl + "?wsdl";
}
HttpTransportSE transport = new HttpTransportSE(wsdl);
try {
transport.call(soapaction, envelope);
} catch (IOException e) {
System.out.println(2);
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
System.out.println(1);
e.printStackTrace();
}
到call()的时候,程序不知何原因停在那边了,没反应
wsdl文件是
<?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.1.3-hudson-390-. -->
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.3-hudson-390-. -->
-<definitions targetNamespace="http://ws.my.com/" name="CalculatorService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:tns="http://ws.my.com/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/">
-<types>
-<xsd:schema>
<xsd:import schemaLocation="http://localhost:8080/King/CalculatorPort?xsd=1" namespace="http://ws.my.com/"/>
</xsd:schema>
</types>
-<message name="add">
<part name="parameters" element="tns:add"/>
</message>
-<message name="addResponse">
<part name="parameters" element="tns:addResponse"/>
</message>
-<message name="divide">
<part name="parameters" element="tns:divide"/>
</message>
-<message name="divideResponse">
<part name="parameters" element="tns:divideResponse"/>
</message>
-<message name="multiply">
<part name="parameters" element="tns:multiply"/>
</message>
-<message name="multiplyResponse">
<part name="parameters" element="tns:multiplyResponse"/>
</message>
-<message name="subtract">
<part name="parameters" element="tns:subtract"/>
</message>
-<message name="subtractResponse">
<part name="parameters" element="tns:subtractResponse"/>
</message>
-<portType name="CalculatorDelegate">
-<operation name="add">
<input message="tns:add"/>
<output message="tns:addResponse"/>
</operation>
-<operation name="divide">
<input message="tns:divide"/>
<output message="tns:divideResponse"/>
</operation>
-<operation name="multiply">
<input message="tns:multiply"/>
<output message="tns:multiplyResponse"/>
</operation>
-<operation name="subtract">
<input message="tns:subtract"/>
<output message="tns:subtractResponse"/>
</operation>
</portType>
-<binding name="CalculatorPortBinding" type="tns:CalculatorDelegate">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
-<operation name="add">
<soap:operation soapAction=""/>
-<input>
<soap:body use="literal"/>
</input>
-<output>
<soap:body use="literal"/>
</output>
</operation>
-<operation name="divide">
<soap:operation soapAction=""/>
-<input>
<soap:body use="literal"/>
</input>
-<output>
<soap:body use="literal"/>
</output>
</operation>
-<operation name="multiply">
<soap:operation soapAction=""/>
-<input>
<soap:body use="literal"/>
</input>
-<output>
<soap:body use="literal"/>
</output>
</operation>
-<operation name="subtract">
<soap:operation soapAction=""/>
-<input>
<soap:body use="literal"/>
</input>
-<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
-<service name="CalculatorService">
-<port name="CalculatorPort" binding="tns:CalculatorPortBinding">
<soap:address location="http://localhost:8080/King/CalculatorPort"/>
</port>
</service>
</definitions>