如何向此肥皂wsdl android添加属性

如何向此肥皂wsdl android添加属性,第1张

概述我的肥皂wsdl是:<soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:tem="http:/empuri.org/"><soapenv:Header/><soapenv:Body><tem:AddTagDetails><!--Optiona

我的肥皂wsdl是:

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  xmlns:tem="http://tempuri.org/">   <soapenv:header/>   <soapenv:Body>      <tem:AddTagDetails>         <!--Optional:-->         <tem:objtag>            <tem:FKPersonID></tem:FKPersonID>            <tem:FKConferenceID></tem:FKConferenceID>            <!--Optional:-->            <tem:Tagname></tem:Tagname>            <tem:CreatedBy></tem:CreatedBy>            <tem:ModifIEdBy></tem:ModifIEdBy>         </tem:objtag>      </tem:AddTagDetails>   </soapenv:Body></soapenv:Envelope>

我正在使用此代码向各个标签添加属性.

SoapObject ad_property = new SoapObject(nameSPACE2,METHOD_name2);

         ad_property.addProperty("FKPersonID", Integer.valueOf(userValues.get(0)));         ad_property.addProperty("FKConferenceID", Integer.valueOf(userValues.get(4)));         ad_property.addProperty("Tagname", tagname.getText().toString());         ad_property.addProperty("CreatedBy", Integer.valueOf(userValues.get(0)));         ad_property.addProperty("ModifIEdBy", Integer.valueOf(userValues.get(0)));

但由于以下原因而出现异常:

  07-15 02:03:29.401: WARN/System.err(583): org.xmlpull.v1.XmlPullParserException: unexpected type (position:END_document null@1:0 in java.io.inputStreamReader@450624b8) 

如何解决这个问题?

方法名:

private static final String METHOD_name2 = "AddTagDetails";    private static final String nameSPACE2 = "http://tempuri.org/";    private static final String URL2 = "http://xxxx.xxxxxx/Tagservice.asmx?wsdl";    private static final String SOAP_ACTION2 = "http://tempuri.org/AddTagDetails"

谢谢

解决方法:

我发现了Atlaaast:

 URL u = new URL(URL2);                 URLConnection uc = u.openConnection();                 connection = (httpURLConnection) uc;                 connection.setDoOutput(true);                 connection.setDoinput(true);                 connection.setRequestProperty("SOAPAction", SOAP_ACTION2);                 connection.setRequestMethod("POST");                 connection.setRequestProperty("Content-type", "text/xml; charset=utf-8");                 String xmldata =                                   "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"  xmlns:tem=\"http://tempuri.org/\"> "+                                   "<soapenv:header/>"+                                  "<soapenv:Body>"+                                  "<tem:AddTagDetails>"+                                  "<tem:objtag>"+                                  "<tem:FKPersonID>"+ Integer.valueOf(JujamaMain.userValues.get(0))+"</tem:FKPersonID>>"+                                  "<tem:FKConferenceID>"+ Integer.valueOf(JujamaMain.userValues.get(4))+"</tem:FKConferenceID>"+                                  "<tem:Tagname>"+tagname.getText().toString()+"</tem:Tagname>"+                                  "<tem:CreatedBy>"+ Integer.valueOf(JujamaMain.userValues.get(0))+"</tem:CreatedBy>"+                                  "<tem:ModifIEdBy>"+ Integer.valueOf(JujamaMain.userValues.get(0))+"</tem:ModifIEdBy>"+                                  "</tem:objtag>"+                                  "</tem:AddTagDetails>"+                                  "</soapenv:Body>"+                                  "</soapenv:Envelope>";                         System.out.println(xmldata);                 OutputStream out = connection.getoutputStream();                 Writer wout = new OutputStreamWriter(out);                  wout.write(xmldata);                    wout.flush();                    wout.close();                    BufferedReader rd = new BufferedReader(new inputStreamReader(connection.getinputStream()));                    System.out.println("code..."+connection.getResponseCode());                      //inputStream in = connection.getinputStream();                      String result;                  //int c;                    while ((result=rd.readline()) != null) {                    System.out.println(result);                    }

它现在正在工作..

谢谢

总结

以上是内存溢出为你收集整理的如何向此肥皂wsdl android添加属性全部内容,希望文章能够帮你解决如何向此肥皂wsdl android添加属性所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/web/1070734.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存