问题描述
当我打电话WCF Web服务,我得到一个错误END_TAF
I am getting an END_TAF error when I call to WCF webservice.
我的堆叠错误是:
09-22 22:43:30.711: W/System.err(3338): org.xmlpull.v1.XmlPullParserException: expected: END_TAG {http://schemas.xmlsoap.org/soap/envelope/}Body (position:END_TAG </{http://schemas.xmlsoap.org/soap/envelope/}s:Fault>@1:802 in java.io.InputStreamReader@536f30c4)
09-22 22:43:30.711: W/System.err(3338): at org.kxml2.io.KXmlParser.require(KXmlParser.java:2046)
09-22 22:43:30.715: W/System.err(3338): at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:138)
09-22 22:43:30.715: W/System.err(3338): at org.ksoap2.transport.Transport.parseResponse(Transport.java:63)
09-22 22:43:30.715: W/System.err(3338): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100)
09-22 22:43:30.715: W/System.err(3338): at org.tempuri.IAndroid.userPasswordExists(IAndroid.java:304)
09-22 22:43:30.715: W/System.err(3338): at org.tempuri.IAndroid.getAllProductsAndOffers(IAndroid.java:50)
09-22 22:43:30.715: W/System.err(3338): at info.android.AllFragment.onCreateView(AllFragment.java:48)
09-22 22:43:30.719: W/System.err(3338): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
09-22 22:43:30.719: W/System.err(3338): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
09-22 22:43:30.719: W/System.err(3338): at android.app.BackStackRecord.run(BackStackRecord.java:635)
09-22 22:43:30.719: W/System.err(3338): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
09-22 22:43:30.719: W/System.err(3338): at android.app.Activity.performStart(Activity.java:5017)
09-22 22:43:30.723: W/System.err(3338): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2032)
09-22 22:43:30.723: W/System.err(3338): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-22 22:43:30.723: W/System.err(3338): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-22 22:43:30.723: W/System.err(3338): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-22 22:43:30.723: W/System.err(3338): at android.os.Handler.dispatchMessage(Handler.java:99)
09-22 22:43:30.727: W/System.err(3338): at android.os.Looper.loop(Looper.java:137)
09-22 22:43:30.727: W/System.err(3338): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-22 22:43:30.727: W/System.err(3338): at java.lang.reflect.Method.invokeNative(Native Method)
09-22 22:43:30.727: W/System.err(3338): at java.lang.reflect.Method.invoke(Method.java:511)
09-22 22:43:30.727: W/System.err(3338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-22 22:43:30.727: W/System.err(3338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-22 22:43:30.727: W/System.err(3338): at dalvik.system.NativeStart.main(Native Method)
09-22 22:43:30.727: W/System.err(3338): java.lang.NullPointerException
09-22 22:43:30.731: W/System.err(3338): at org.tempuri.IAndroid.getAllProductsAndOffers(IAndroid.java:50)
09-22 22:43:30.731: W/System.err(3338): at info.android.AllFragment.onCreateView(AllFragment.java:48)
09-22 22:43:30.731: W/System.err(3338): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:829)
09-22 22:43:30.735: W/System.err(3338): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1035)
09-22 22:43:30.735: W/System.err(3338): at android.app.BackStackRecord.run(BackStackRecord.java:635)
09-22 22:43:30.735: W/System.err(3338): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1397)
09-22 22:43:30.735: W/System.err(3338): at android.app.Activity.performStart(Activity.java:5017)
09-22 22:43:30.735: W/System.err(3338): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2032)
09-22 22:43:30.735: W/System.err(3338): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
09-22 22:43:30.735: W/System.err(3338): at android.app.ActivityThread.access$600(ActivityThread.java:130)
09-22 22:43:30.735: W/System.err(3338): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
09-22 22:43:30.739: W/System.err(3338): at android.os.Handler.dispatchMessage(Handler.java:99)
09-22 22:43:30.739: W/System.err(3338): at android.os.Looper.loop(Looper.java:137)
09-22 22:43:30.739: W/System.err(3338): at android.app.ActivityThread.main(ActivityThread.java:4745)
09-22 22:43:30.739: W/System.err(3338): at java.lang.reflect.Method.invokeNative(Native Method)
09-22 22:43:30.739: W/System.err(3338): at java.lang.reflect.Method.invoke(Method.java:511)
09-22 22:43:30.743: W/System.err(3338): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
09-22 22:43:30.743: W/System.err(3338): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-22 22:43:30.743: W/System.err(3338): at dalvik.system.NativeStart.main(Native Method)
我打电话是要测试用户名和密码校验的功能。
我使用ksoap2的过程。在code是:
I am calling a function to test user and password check.The procedure I am using ksoap2. The code is:
公共静态WcfResponse userPasswordExists(java.lang.String中的用户名,java.lang.String中PWD){
字符串METHOD_NAME =userPasswordExists;
WcfResponse RES = NULL;
public static WcfResponse userPasswordExists(java.lang.String username, java.lang.String pwd) { String METHOD_NAME = "userPasswordExists"; WcfResponse res = null;
try {
String SOAP_ACTION = Configuration.getWsSoapActionInit() + METHOD_NAME;
SoapObject _client = new SoapObject(Configuration.getWsNameSpace(), METHOD_NAME);
_client.addProperty("username", username);
_client.addProperty("pwd", (pwd.equals(""))? null: pwd);
SoapSerializationEnvelope _envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
_envelope.dotNet = true;
_envelope.bodyOut = _client;
AndroidHttpTransport _ht = new AndroidHttpTransport(Configuration.getWsUrl());
_ht.debug = false;
_ht.call(SOAP_ACTION, _envelope);
SoapObject _ret = (SoapObject) _envelope.getResponse();
res = SoapMapping.ToWcfResponse(_ret);
} catch (Exception e) {
e.printStackTrace();
res = null;
}
return res;
}
我检查everythinbg和ITIS吧,反正code它是anotherone它是工作,我不知道副本为什么这一个。
I checked everythinbg and itis right, anyway, the code it is a copy of anotherone which it is working, I dont know why this one.
我的WCF接口是:
public interface IAndroid
{
[OperationContract]
WcfResponse EnviarCorreo(string To, string Asunto, string Body);
[OperationContract]
WcfResponse UserPasswordExists(string username, string pwd);
[OperationContract]
WcfResponse UserExists(string username);
[OperationContract]
WcfResponsePOList getAllProductsAndOffers(string province_id, string city_id, string code, string favoritos, string tipo);
[OperationContract]
WcfResponsePO getProductByCodigo(string codigo);
[OperationContract]
WcfResponsePO getOfferByCodigo(string codigo);
[OperationContract]
WcfResponseOK BuyProductOrOffer(string codigo, string tipo, string ip);
[OperationContract]
WcfResponsePOList getProductsByOfferCode(string codigo);
[OperationContract]
WcfResponseOK SetFavouriteOff(string codigo, string tipo);
[OperationContract]
WcfResponseOK SetFavouriteOn(string codigo, string tipo, string ip);
[OperationContract]
WcfResponseByteArray ImageToByteArray(string file);
[OperationContract]
WcfResponseDictionary getAllProvincies();
[OperationContract]
WcfResponseDictionary getAllCities();
}
和在web.config是:
And the web.config is:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration>
<appSettings>
<add key="connection" value="Server=localhost;Port=3306;Database=david;Uid=root;Pwd=root;" />
<add key="uploads" value="C:\Users\DMR\Google Drive\DESARROLLO\PHP\android\contents\img\uploads\" />
</appSettings>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" closeTimeout="01:50:00" openTimeout="01:50:00" sendTimeout="01:50:00" receiveTimeout="01:50:00">
<readerQuotas maxDepth="128" maxStringContentLength="8388608" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
<binding name="BasicHttpBinding_IAndroid" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost/Android/Android.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IAndroid" contract="IAndroid"
name="BasicHttpBinding_IAndroid" />
</client>
<services>
<service behaviorConfiguration="ServiceBehavior" name="Android.Android">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBinding" contract="Android.IAndroid" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false" />
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
</behavior>
<behavior name=" MyClient">
<dataContractSerializer ignoreExtensionDataObject="false" maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.web>
<compilation debug="true" />
</system.web>
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
什么是在code中的problema?你需要更多的东西?
What is the problema in the code? do you need something more?
也许我需要其他的眼神帮助我
maybe I need other eyes to help me
推荐答案
也许我需要把常量的内容,我解决了这个错误,SOOO愚蠢的WCF我作为函数声明UserPasswordExists和KSOAP呼叫userPasswordExists
Maybe I need to put the content of the constants, I solved the error, sooo stupid in WCF I had as function declaration UserPasswordExists and in ksoap call userPasswordExists
grrrrrrr
这篇关于机器人:为什么我会得到END_TAG错误,当我执行一个功能,而这是其他这是工作一个复制粘贴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!