Nav2009网络服务通过android?

时间:2013-12-02 09:30:55

标签: android web-services navision

我试图从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}}

1 个答案:

答案 0 :(得分:0)

据我所知,您的XML无效。它包含";"例如,标签之间。尝试生成适当的XML。

以下是您可以尝试的内容:

  1. 运行SOAPui(SNAPSHOT构建支持NTLM身份验证)
  2. 使用Nav WS(将WSDL的URL提供给SOAPui)
  3. 生成示例XML请求(有一个命令)
  4. 删除每行末尾的不可打印字符。那些由app添加的,对我而言,它看起来像一个bug,Nav也不喜欢它们。
  5. 删除<v:Header /><v:Body>之间的所有字符,包括CR。看起来Nav WS中有一个错误。
  6. 插入要请求的参数。
  7. 运行请求。
  8. 如果有错误修复它们并使请求工作。在您处理XML请求后,强制您的任何lib生成相同的请求。