2012-06-13 59 views
0

我想提出一個例子調用的Zend(PHP框架)由WSDL web服務的,我使用KSOAP API(jar文件),我得到這個錯誤錯誤的Android

org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <definitions name='Ccc_Core_Model_Api_Server' targetNamespace='http://gsmadmin.com/zendtest/api'>@2:385 in [email protected])

我閱讀了有關此錯誤的所有stackoverflow的問題,但我無法解決此錯誤。

這個錯誤的真正解決方案是什麼?

請幫幫我。

我的WSDL的xml文件是:

<?xml version="1.0"?>    
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://gsmadmin.com/zendtest/api" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="Ccc_Core_Model_Api_Server" targetNamespace="http://gsmadmin.com/zendtest/api"> 
<types>    
<xsd:schema targetNamespace="http://gsmadmin.com/zendtest/api"/> 
</types>  
<portType name="Ccc_Core_Model_Api_ServerPort"> 
<operation name="addition"> 
<documentation> This method is used for addition of two numbers</documentation> 
<input message="tns:additionIn"/> 
<output message="tns:additionOut"/> 
</operation> 
<operation name="substraction"> 
<documentation> This method is used for substraction of two numbers</documentation> 
<input message="tns:substractionIn"/> 
<output message="tns:substractionOut"/> 
</operation>  
<operation name="multiple"> 
<documentation>This method is used for multiple of two numbers</documentation> 
<input message="tns:multipleIn"/> 
<output message="tns:multipleOut"/> 
</operation> 
<operation name="division"> 
<documentation>This method is used for division of two numbers</documentation> 
<input message="tns:divisionIn"/> 
<output message="tns:divisionOut"/> 
</operation> 
</portType> 
<binding name="Ccc_Core_Model_Api_ServerBinding" type="tns:Ccc_Core_Model_Api_ServerPort"> 
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
<operation name="addition"> 
<soap:operation soapAction="http://gsmadmin.com/zendtest/api#addition"/> 
<input> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</input> 
<output> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</output> 
</operation> 
<operation name="substraction"> 
<soap:operation soapAction="http://gsmadmin.com/zendtest/api#substraction"/> 
<input> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</input> 
<output> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</output> 
</operation> 
<operation name="multiple"> 
<soap:operation soapAction="http://gsmadmin.com/zendtest/api#multiple"/> 
<input>  
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</input> 
<output> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</output> 
</operation> 
<operation name="division"> 
<soap:operation soapAction="http://gsmadmin.com/zendtest/api#division"/>  
<input> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</input> 
<output> 
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://gsmadmin.com/zendtest/api"/> 
</output> 
</operation> 
</binding> 
<service name="Ccc_Core_Model_Api_ServerService"> 
<port name="Ccc_Core_Model_Api_ServerPort" binding="tns:Ccc_Core_Model_Api_ServerBinding"> 
<soap:address location="http://gsmadmin.com/zendtest/api"/> 
</port> 
</service> 
<message name="additionIn"> 
<part name="param1" type="xsd:int"/> 
<part name="param2" type="xsd:int"/> 
</message> 
<message name="additionOut"> 
<part name="return" type="xsd:float"/> 
</message> 
<message name="substractionIn"> 
<part name="param1" type="xsd:int"/> 
<part name="param2" type="xsd:int"/> 
</message>  
<message name="substractionOut"> 
<part name="return" type="xsd:float"/>  
</message>  
<message name="multipleIn">  
<part name="param1" type="xsd:int"/>  
<part name="param2" type="xsd:int"/> 
</message> 
<message name="multipleOut"> 
<part name="return" type="xsd:float"/>  
</message> 
<message name="divisionIn">  
<part name="param1" type="xsd:float"/> 
<part name="param2" type="xsd:float"/> 
</message>  
<message name="divisionOut"> 
<part name="return" type="xsd:float"/> 
</message> 
</definitions> 

異常堆棧跟蹤:

06-14 15:45:49.527: D/AndroidRuntime(2055): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< 
06-14 15:45:49.527: D/AndroidRuntime(2055): CheckJNI is ON 
06-14 15:45:50.587: D/AndroidRuntime(2055): Calling main entry com.android.commands.pm.Pm 
06-14 15:45:50.637: D/AndroidRuntime(2055): Shutting down VM 
06-14 15:45:50.657: D/dalvikvm(2055): GC_CONCURRENT freed 101K, 71% free 297K/1024K, external 0K/0K, paused 1ms+1ms 
06-14 15:45:50.657: I/AndroidRuntime(2055): NOTE: attach of thread 'Binder Thread #3' failed 
06-14 15:45:50.669: D/jdwp(2055): Got wake-up signal, bailing out of select 
06-14 15:45:50.677: D/dalvikvm(2055): Debugger has detached; object registry had 1 entries 
06-14 15:45:51.247: D/AndroidRuntime(2065): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<< 
06-14 15:45:51.247: D/AndroidRuntime(2065): CheckJNI is ON 
06-14 15:45:52.147: D/AndroidRuntime(2065): Calling main entry com.android.commands.am.Am 
06-14 15:45:52.197: I/ActivityManager(61): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.phpwebservice/.PhpwebservicedemoActivity } from pid 2065 
06-14 15:45:52.267: D/AndroidRuntime(2065): Shutting down VM 
06-14 15:45:52.317: D/dalvikvm(2065): GC_CONCURRENT freed 103K, 69% free 319K/1024K, external 0K/0K, paused 2ms+1ms 
06-14 15:45:52.389: V/Adapter(1868): URL = http://gsmadmin.com/zendtest/api?wsdl 
06-14 15:45:52.389: D/jdwp(2065): Got wake-up signal, bailing out of select 
06-14 15:45:52.389: D/dalvikvm(2065): Debugger has detached; object registry had 1 entries 
06-14 15:45:52.447: V/Adapter(1868): NAMESPACE = http://gsmadmin.com/zendtest/api 
06-14 15:45:52.447: V/Adapter(1868): METHOD_NAME = addition 
06-14 15:45:52.447: V/Adapter(1868): SOAP_ACTION = http://gsmadmin.com/zendtest/api#addition 
06-14 15:45:52.447: V/Adapter(1868): request = addition{param1=10; param2=2; } 
06-14 15:45:52.487: V/Adapter(1868): param1 = 10 param2 = 2 
06-14 15:45:53.737: W/System.err(1868): org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <definitions name='Ccc_Core_Model_Api_Server' targetNamespace='http://gsmadmin.com/zendtest/api'>@2:385 in [email protected]) 
06-14 15:45:53.757: W/System.err(1868):  at org.kxml2.io.KXmlParser.exception(KXmlParser.java:273) 
06-14 15:45:53.757: W/System.err(1868):  at org.kxml2.io.KXmlParser.require(KXmlParser.java:1424) 
06-14 15:45:53.757: W/System.err(1868):  at org.ksoap2.SoapEnvelope.parse(SoapEnvelope.java:127) 
06-14 15:45:53.766: W/System.err(1868):  at org.ksoap2.transport.Transport.parseResponse(Transport.java:63) 
06-14 15:45:53.766: W/System.err(1868):  at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:100) 
06-14 15:45:53.766: W/System.err(1868):  at com.phpwebservice.Adapter.addition(Adapter.java:59) 
06-14 15:45:53.777: W/System.err(1868):  at com.phpwebservice.PhpwebservicedemoActivity.onCreate(PhpwebservicedemoActivity.java:53) 
06-14 15:45:53.777: W/System.err(1868):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
06-14 15:45:53.787: W/System.err(1868):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 
06-14 15:45:53.787: W/System.err(1868):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 
06-14 15:45:53.787: W/System.err(1868):  at android.app.ActivityThread.access$1500(ActivityThread.java:117) 
06-14 15:45:53.787: W/System.err(1868):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 
06-14 15:45:53.809: W/System.err(1868):  at android.os.Handler.dispatchMessage(Handler.java:99) 
06-14 15:45:53.809: W/System.err(1868):  at android.os.Looper.loop(Looper.java:123) 
06-14 15:45:53.809: W/System.err(1868):  at android.app.ActivityThread.main(ActivityThread.java:3683) 
06-14 15:45:53.809: W/System.err(1868):  at java.lang.reflect.Method.invokeNative(Native Method) 
06-14 15:45:53.817: W/System.err(1868):  at java.lang.reflect.Method.invoke(Method.java:507) 
06-14 15:45:53.817: W/System.err(1868):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
06-14 15:45:53.817: W/System.err(1868):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
06-14 15:45:53.817: W/System.err(1868):  at dalvik.system.NativeStart.main(Native Method) 
06-14 15:45:53.817: V/log_tag(1868): total addition = 0.0 
06-14 15:45:54.069: I/ActivityManager(61): Displayed com.phpwebservice/.PhpwebservicedemoActivity: +1s835ms 
06-14 15:45:59.297: D/dalvikvm(126): GC_EXPLICIT freed 4K, 50% free 3003K/5895K, external 5903K/7371K, paused 63ms 

在此先感謝

回答

0

有XML中的一個錯誤,從你貼什麼,我覺得有沒有開始標籤。如果發佈更多堆棧跟蹤,可能會更容易發現問題。

+0

我得到的解決方案,我張貼在下面,感謝您的答案... – Jayesh

0

的Wooo ....

最後3天之後嘗試我得到了解決,

問題是URL,

網址爲「http://gsmadmin.com/zendtest/API?WSDL」

現在我將其更改爲「http://gsmadmin.com/zendtest/api」

但我不知道爲什麼需要從url中刪除?wsdl,因爲在之前的項目中我最後使用了?wsdl(這是在java -JAX-WS-RI中創建的)的URL,但是在最近如果我使用與?WSDL的URL,然後它給我的錯誤,

兩個Web服務在不同的工藝製成,一個在JAVA中,另一個在Zend公司(PHP框架)等都可能是結構不同,

但最後還是覺得放鬆。 ....

謝謝.......