2012-03-08 2 views
0

내 Android에서 Google Apple Engine에서 만든 웹 서비스를 호출하려고합니다. 테스트하는 동안이 오류가 발생했습니다.
org.xmlpull.v1.XmlPullParserException : 기대 값 : {START_TAG http://schemas.xmlsoap.org/soap/envelope/}Envelope
(총수 : [email protected] 7 : START_TAG @ 1) 도와주세요.웹 서비스 - org.xmlpull.v1.XmlPullParserException :

아래 코드는 제 코드입니다.

private static final String SOAP_ACTION = "http://example.com/sayHello"; 
    private static final String OPERATION_NAME = "sayHello"; 
    private static final String WSDL_TARGET_NAMESPACE = "http://example.com/"; 
    private static final String SOAP_ADDRESS = "http://mynewcloudcom.appspot.com/hellosoapserver"; 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     TextView textView = new TextView(this); 
     SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, 
       OPERATION_NAME); 
     request.addProperty("arg0","ONE"); 
     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
       SoapEnvelope.VER11); 
     envelope.dotNet = false; 
     envelope.setOutputSoapObject(request); 
     HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS); 
     httpTransport.debug = true; 
     try { 
      httpTransport.call(SOAP_ACTION, envelope); 
      Log.v("TEST", httpTransport.requestDump); 
      Log.v("TEST", httpTransport.responseDump); 
      Object response = envelope.getResponse();  
      textView.setText(response.toString()); 
     } catch (Exception exception) { 
      textView.setText(exception.toString()); 
     } 

심지어 soap_address를 WSDL 파일로 변경하려고 시도하지만 여전히 동일한 오류가 발생합니다.

private static final String SOAP_ADDRESS = "http://mynewcloudcom.appspot.com/GreeterService.wsdl"; 

WSDL 파일

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<definitions targetNamespace="http://example.com/" name="GreeterService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://example.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"> 
    <types> 
    <xsd:schema> 
     <xsd:import namespace="http://example.com/" schemaLocation="GreeterService_schema1.xsd"/> 
    </xsd:schema> 
    </types> 
    <message name="sayHello"> 
    <part name="parameters" element="tns:sayHello"/> 
    </message> 
    <message name="sayHelloResponse"> 
    <part name="parameters" element="tns:sayHelloResponse"/> 
    </message> 
    <message name="sayGoodbye"> 
    <part name="parameters" element="tns:sayGoodbye"/> 
    </message> 
    <message name="sayGoodbyeResponse"> 
    <part name="parameters" element="tns:sayGoodbyeResponse"/> 
    </message> 
    <portType name="Greeter"> 
    <operation name="sayHello"> 
     <input wsam:Action="http://example.com/Greeter/sayHelloRequest" message="tns:sayHello"/> 
     <output wsam:Action="http://example.com/Greeter/sayHelloResponse" message="tns:sayHelloResponse"/> 
    </operation> 
    <operation name="sayGoodbye"> 
     <input wsam:Action="http://example.com/Greeter/sayGoodbyeRequest" message="tns:sayGoodbye"/> 
     <output wsam:Action="http://example.com/Greeter/sayGoodbyeResponse" message="tns:sayGoodbyeResponse"/> 
    </operation> 
    </portType> 
    <binding name="GreeterPortBinding" type="tns:Greeter"> 
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> 
    <operation name="sayHello"> 
     <soap:operation soapAction=""/> 
     <input> 
     <soap:body use="literal"/> 
     </input> 
     <output> 
     <soap:body use="literal"/> 
     </output> 
    </operation> 
    <operation name="sayGoodbye"> 
     <soap:operation soapAction=""/> 
     <input> 
     <soap:body use="literal"/> 
     </input> 
     <output> 
     <soap:body use="literal"/> 
     </output> 
    </operation> 
    </binding> 
    <service name="GreeterService"> 
    <port name="GreeterPort" binding="tns:GreeterPortBinding"> 
     <soap:address location="http://mynewcloudcom.appspot.com/hellosoapserver"/> 
    </port> 
    </service> 
</definitions> 

XSD 파일 도움말들에 대한

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<xs:schema version="1.0" targetNamespace="http://example.com/" xmlns:tns="http://example.com/" xmlns:xs="http://www.w3.org/2001/XMLSchema"> 
    <xs:element name="sayGoodbye" type="tns:sayGoodbye"/> 
    <xs:element name="sayGoodbyeResponse" type="tns:sayGoodbyeResponse"/> 
    <xs:element name="sayHello" type="tns:sayHello"/> 
    <xs:element name="sayHelloResponse" type="tns:sayHelloResponse"/> 
    <xs:complexType name="sayHello"> 
    <xs:sequence> 
     <xs:element name="arg0" type="xs:string" minOccurs="0"/> 
    </xs:sequence> 
    </xs:complexType> 
    <xs:complexType name="sayHelloResponse"> 
    <xs:sequence> 
     <xs:element name="return" type="xs:string" minOccurs="0"/> 
    </xs:sequence> 
    </xs:complexType> 
    <xs:complexType name="sayGoodbye"> 
    <xs:sequence> 
     <xs:element name="arg0" type="xs:string" minOccurs="0"/> 
    </xs:sequence> 
    </xs:complexType> 
    <xs:complexType name="sayGoodbyeResponse"> 
    <xs:sequence> 
     <xs:element name="return" type="xs:string" minOccurs="0"/> 
    </xs:sequence> 
    </xs:complexType> 
</xs:schema> 
+0

이것은 XML이 유효하지 않음을 나타냅니다. 우리에게 XML을 보여주십시오. –

+0

내 wsdl 및 xsd 파일을 추가했습니다. –

+0

응답으로 얻는 비누 봉투 인 XML 자체를 게시 할 수 있습니까? –

답변

0

감사합니다. 문제는 지금 해결되었습니다. 그것의 JDK 문제. jdk 1.6을 사용하여 프로젝트를 다시 만들고 GAE에 배포합니다. 지금은 괜찮아. 다시 한번 감사드립니다. 무슨 릴리프 .. 페어 ...

관련 문제