webservice地址:http://172.16.1.10/oa/services/UserWebService?wsdlwebservice内容: <?xml version="1.0" encoding="UTF-8" ?>
- <wsdl:definitions targetNamespace="http://webservice.service.oa.org" xmlns:ns1="http://pojos.oa.org" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://webservice.service.oa.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservice.service.oa.org">
- <xsd:element name="doLogin">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="in2" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>android 调用该webservice方法 static final String SERVICE_NS = "http://webservice.service.oa.org";
// 定义Web Service提供服务的URL
static final String SERVICE_URL = "http://172.16.1.10/oa/services/UserWebService?wsdl";
// 调用Web Service登录
public static void doLogin(String username,String password)
{
//调用的方法名称
String methodName = "doLogin";
// 创建HttpTransportSE传输对象
HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
ht.debug = true;
// 使用SOAP1.1协议创建Envelop对象,SoapEnvelope.VER11,VER10,VER12//都不行
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
// 实例化SoapObject对象
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
// 添加请求参数
soapObject.addProperty("in0 ",username);
soapObject.addProperty("in1", password);
envelope.bodyOut = soapObject;
// 设置与.Net提供的Web Service保持较好的兼容性,该webservice是java编写
envelope.dotNet = false;
envelope.setOutputSoapObject(soapObject);//设置请求参数 try
{
// 调用Web Service
ht.call(SERVICE_NS + methodName, envelope);
if (envelope.getResponse() != null)
{
// 获取服务器响应返回的SOAP消息
SoapObjectresult = (SoapObject) envelope.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(methodName
+ "Result");
// 解析服务器响应的SOAP消息。
System.out.println("----------------------detail"+result);
}
}
catch (IOException e)
{ Log.e("IO", "IO异常");
e.printStackTrace();
}
catch (XmlPullParserException e)
{
Log.e("XmlPullParserException", "XmlPullParserException异常");
e.printStackTrace();
}
AndroidManifest.xml
<权限已加入>
<uses-permission android:name="android.permission.INTERNET" />调用时报错
org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <{http://schemas.xmlsoap.org/wsdl/}wsdl:definitions targetNamespace='http://webservice.service.oa.org'>@2:523 in java.io.InputStreamReader@4056be18) 求大神帮帮忙~~多谢
- <wsdl:definitions targetNamespace="http://webservice.service.oa.org" xmlns:ns1="http://pojos.oa.org" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://webservice.service.oa.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
- <wsdl:types>
- <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservice.service.oa.org">
- <xsd:element name="doLogin">
- <xsd:complexType>
- <xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true" type="xsd:string" />
<xsd:element maxOccurs="1" minOccurs="1" name="in2" nillable="true" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>android 调用该webservice方法 static final String SERVICE_NS = "http://webservice.service.oa.org";
// 定义Web Service提供服务的URL
static final String SERVICE_URL = "http://172.16.1.10/oa/services/UserWebService?wsdl";
// 调用Web Service登录
public static void doLogin(String username,String password)
{
//调用的方法名称
String methodName = "doLogin";
// 创建HttpTransportSE传输对象
HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);
ht.debug = true;
// 使用SOAP1.1协议创建Envelop对象,SoapEnvelope.VER11,VER10,VER12//都不行
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
// 实例化SoapObject对象
SoapObject soapObject = new SoapObject(SERVICE_NS, methodName);
// 添加请求参数
soapObject.addProperty("in0 ",username);
soapObject.addProperty("in1", password);
envelope.bodyOut = soapObject;
// 设置与.Net提供的Web Service保持较好的兼容性,该webservice是java编写
envelope.dotNet = false;
envelope.setOutputSoapObject(soapObject);//设置请求参数 try
{
// 调用Web Service
ht.call(SERVICE_NS + methodName, envelope);
if (envelope.getResponse() != null)
{
// 获取服务器响应返回的SOAP消息
SoapObjectresult = (SoapObject) envelope.bodyIn;
SoapObject detail = (SoapObject) result.getProperty(methodName
+ "Result");
// 解析服务器响应的SOAP消息。
System.out.println("----------------------detail"+result);
}
}
catch (IOException e)
{ Log.e("IO", "IO异常");
e.printStackTrace();
}
catch (XmlPullParserException e)
{
Log.e("XmlPullParserException", "XmlPullParserException异常");
e.printStackTrace();
}
AndroidManifest.xml
<权限已加入>
<uses-permission android:name="android.permission.INTERNET" />调用时报错
org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <{http://schemas.xmlsoap.org/wsdl/}wsdl:definitions targetNamespace='http://webservice.service.oa.org'>@2:523 in java.io.InputStreamReader@4056be18) 求大神帮帮忙~~多谢
<wsdl:definitions targetNamespace="http://webservice.service.oa.org" xmlns:ns1="http://pojos.oa.org" xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding" xmlns:tns="http://webservice.service.oa.org" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://webservice.service.oa.org">
<xsd:element name="doLogin">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true" type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="in2" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="doLoginResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true" type="ns1:User"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="submitPassword">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" type="xsd:long"/>
<xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="submitPasswordResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://pojos.oa.org">
<xsd:complexType name="User">
<xsd:sequence>
<xsd:element minOccurs="0" name="FCellphone" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FDeptcode" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FDeptid" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FDeptname" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FIpAddress" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FLogin" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FMail" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FName" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FNote" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FOragnation" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FOrder" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FPassword" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FSecretary" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FSecretaryid" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FSmsset" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FState" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FUsertype" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="id" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="lastonlinetime" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="lastonlinetimeold" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="lock" type="xsd:int"/>
<xsd:element minOccurs="0" name="popupUserDefs" nillable="true" type="ns1:ArrayOfPopupUserDef"/>
<xsd:element minOccurs="0" name="rolename" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ArrayOfPopupUserDef">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0" name="PopupUserDef" nillable="true" type="ns1:PopupUserDef"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PopupUserDef">
<xsd:sequence>
<xsd:element minOccurs="0" name="FAllowIntegrate" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FAllowMutiPopup" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FAllowpop" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FAllowsound" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FMsecHold" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FMsecInterval" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="FSoundfile" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FTodoSource" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="FUserid" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="id" nillable="true" type="xsd:long"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="submitPasswordResponse">
<wsdl:part name="parameters" element="tns:submitPasswordResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doLoginRequest">
<wsdl:part name="parameters" element="tns:doLogin">
</wsdl:part>
</wsdl:message>
<wsdl:message name="submitPasswordRequest">
<wsdl:part name="parameters" element="tns:submitPassword">
</wsdl:part>
</wsdl:message>
<wsdl:message name="doLoginResponse">
<wsdl:part name="parameters" element="tns:doLoginResponse">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="UserWebServicePortType">
<wsdl:operation name="doLogin">
<wsdl:input name="doLoginRequest" message="tns:doLoginRequest">
</wsdl:input>
<wsdl:output name="doLoginResponse" message="tns:doLoginResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitPassword">
<wsdl:input name="submitPasswordRequest" message="tns:submitPasswordRequest">
</wsdl:input>
<wsdl:output name="submitPasswordResponse" message="tns:submitPasswordResponse">
</wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="UserWebServiceHttpBinding" type="tns:UserWebServicePortType">
<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="doLogin">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="doLoginRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="doLoginResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="submitPassword">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="submitPasswordRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="submitPasswordResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="UserWebService">
<wsdl:port name="UserWebServiceHttpPort" binding="tns:UserWebServiceHttpBinding">
<wsdlsoap:address location="http://172.16.1.10/oa/services/UserWebService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>