我试图从Android客户端访问nav 2009 Web服务。
我尝试了ksoap2
库和jcifs
库。 ksoap2
illegalargumentexception
transport.call
jcifs
authentication error
protected Void doInBackground(String... arg0) {
// TODO Auto-generated method stub
String webserviceIP = "-------------"; // IP of the server.
String username = "---------"; // Domain username
String password ="--------"; // Domain password
String deviceIP="" ;
String domainName = "-----"; // Domain name
DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getAuthSchemes().register("ntlm", new NTLMSchemeFactory());
httpclient.getCredentialsProvider().setCredentials(new AuthScope(webserviceIP, -1), new NTCredentials(username, password, deviceIP, domainName));
HttpGet httpGet = new HttpGet(URL);
httpGet.getParams().setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE, false);
HttpResponse response = null;
try {
response = httpclient.execute(httpGet);
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
String responseXML = EntityUtils.toString(response.getEntity());
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
。
有没有其他方法可以访问导航网络服务?
JCIFS:
SoapObject request=new SoapObject(NAMESPACE,METHOD_NAME);
request.addProperty("No", arg0[0]);
SoapSerializationEnvelope envelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE transport = new HttpTransportSE(URL);
try {
transport.call(SOAP_ACTION, envelope);
} catch (HttpResponseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//SoapObject result = (SoapObject) envelope.getResponse();
ksoap2:
{{1}}
答案 0 :(得分:0)
据我所知,您的XML无效。它包含";"例如,标签之间。尝试生成适当的XML。
以下是您可以尝试的内容:
<v:Header />
和<v:Body>
之间的所有字符,包括CR。看起来Nav WS中有一个错误。如果有错误修复它们并使请求工作。在您处理XML请求后,强制您的任何lib生成相同的请求。