PHP nusoap服务器-调用时ksoap2客户端(Soap信封)错误

PHP nusoap服务器-调用时ksoap2客户端(Soap信封)错误,php,xml,wsdl,nusoap,android-ksoap2,Php,Xml,Wsdl,Nusoap,Android Ksoap2,恩:我在用PHP和Android。我正在使用nusoap创建一个WSDL服务器,并使用ksoap2创建一个客户端。我在尝试从androidHttpTransport执行方法调用时收到解析器错误 我在PHP中使用WSDL作为WSDL代码,并且执行时没有错误 错误: org.xmlpull.v1.XmlPullParserException:应为:开始标记{http://schemas.xmlsoap.org/soap/envelope/}信封(位置:java.io中的START_TAG@2:455

恩:我在用PHP和Android。我正在使用nusoap创建一个WSDL服务器,并使用ksoap2创建一个客户端。我在尝试从androidHttpTransport执行方法调用时收到解析器错误

我在PHP中使用WSDL作为WSDL代码,并且执行时没有错误

错误: org.xmlpull.v1.XmlPullParserException:应为:开始标记{http://schemas.xmlsoap.org/soap/envelope/}信封(位置:java.io中的START_TAG@2:455。InputStreamReader@4054fe80)

变数

private final static String WEB_SERVICE_URI = "http://172.224.116.242/test.php";
private final static String WEB_SERVICE_NAMESPACE = "urn:smspublish.aldeiati.com";
private final static String WS_METHOD_GET_TOKEN = "SBPublish.getToken";
Android中的代码(ksoap2-客户端)


好的,您应该发布XML,这样可以查看错误与何处有关。我发现错误,我的URL是错误的,超过了WSDL URL,但是ksoap2需要URL端点。谢谢。添加您的解决方案作为问题的答案。一段时间后,您可以接受它作为解决方案。这会将您的问题标记为已解决,并可能帮助其他人看到类似的错误消息。
            SoapObject parameters = new SoapObject(WEB_SERVICE_NAMESPACE,
            WS_METHOD_GET_TOKEN);

    parameters.addProperty("username", "test@aldeiati.com");
    parameters.addProperty("password", "123456");
    parameters.addProperty("deviceIMEI", "000000000000000");
    parameters.addProperty("deviceDDI", "us");
    parameters.addProperty("deviceNumber", "15555215554");

    SoapSerializationEnvelope envelope = this.getEnvelope(parameters);
    String host = this.getWebServiceURI();

    HttpTransportSE androidHttpTransport = new HttpTransportSE(host);
    androidHttpTransport
            .setXmlVersionTag("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    androidHttpTransport.debug = true;


    try {
        androidHttpTransport.call(WS_METHOD_GET_TOKEN, envelope);
        SoapObject response =(SoapObject) envelope.getResponse();

        return response.toString();
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    } catch (XmlPullParserException xe) {
        xe.printStackTrace();
        return null;
    }
<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:smspublish.aldeiati.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:smspublish.aldeiati.com">
<types>
<xsd:schema targetNamespace="urn:smspublish.aldeiati.com"
>
 <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
 <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
 <xsd:complexType name="Token">
  <xsd:all>
   <xsd:element name="token" type="xsd:string"/>
   <xsd:element name="expireIn" type="xsd:long"/>
   <xsd:element name="status" type="xsd:int"/>
   <xsd:element name="error" type="xsd:int"/>
  </xsd:all>
 </xsd:complexType>
</xsd:schema>
</types>
<message name="SBPublish.checkServerRequest">
  <part name="nome" type="xsd:string" /></message>
<message name="SBPublish.checkServerResponse">
  <part name="return" type="xsd:token" /></message>
<message name="SBPublish.syncServerRequest">
  <part name="token" type="xsd:string" />
  <part name="data" type="xsd:string" /></message>
<message name="SBPublish.syncServerResponse">
  <part name="return" type="xsd:string" /></message>
<message name="SBPublish.getTokenRequest">
  <part name="mail" type="xsd:string" />
  <part name="password" type="xsd:string" />
  <part name="deviceIMEI" type="xsd:string" />
  <part name="deviceDDI" type="xsd:string" />
  <part name="deviceNumber" type="xsd:string" /></message>
<message name="SBPublish.getTokenResponse">
  <part name="return" type="tns:Token" /></message>
<portType name="smspublish.aldeiati.comPortType">
  <operation name="SBPublish.checkServer">
    <documentation>Testando o servidor</documentation>
    <input message="tns:SBPublish.checkServerRequest"/>
    <output message="tns:SBPublish.checkServerResponse"/>
  </operation>
  <operation name="SBPublish.syncServer">
    <documentation>Transmite ao servidor o registro as atividades realizadas e recupera novas atividades</documentation>
    <input message="tns:SBPublish.syncServerRequest"/>
    <output message="tns:SBPublish.syncServerResponse"/>
  </operation>
  <operation name="SBPublish.getToken">
    <documentation>Gera um token para comunicação entre o dispositivo e o servidor</documentation>
    <input message="tns:SBPublish.getTokenRequest"/>
    <output message="tns:SBPublish.getTokenResponse"/>
  </operation>
</portType>
<binding name="smspublish.aldeiati.comBinding" type="tns:smspublish.aldeiati.comPortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="SBPublish.checkServer">
    <soap:operation soapAction="SBPublish.checkServer" style="rpc"/>
    <input><soap:body use="encoded" namespace="urn:smspublish.aldeiati.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
    <output><soap:body use="encoded" namespace="urn:smspublish.aldeiati.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
  </operation>
  <operation name="SBPublish.syncServer">
    <soap:operation soapAction="SBPublish.syncServer" style="rpc"/>
    <input><soap:body use="encoded" namespace="urn:smspublish.aldeiati.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
    <output><soap:body use="encoded" namespace="urn:smspublish.aldeiati.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
  </operation>
  <operation name="SBPublish.getToken">
    <soap:operation soapAction="SBPublish.getToken" style="rpc"/>
    <input><soap:body use="encoded" namespace="urn:smspublish.aldeiati.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
    <output><soap:body use="encoded" namespace="urn:smspublish.aldeiati.com" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
  </operation>
</binding>
<service name="smspublish.aldeiati.com">
  <port name="smspublish.aldeiati.comPort" binding="tns:smspublish.aldeiati.comBinding">
    <soap:address location="http://172.224.116.242/test.php"/>
  </port>
</service>
</definitions>
<?xml version="1.0" encoding="UTF-8"?>
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/">
<v:Header />
<v:Body>
<n0:SBPublish.getToken id="o0" c:root="1" xmlns:n0="urn:smspublish.aldeiati.com">
<username i:type="d:string">test@aldeiati.com</username>
<password i:type="d:string">123456</password>
<deviceIMEI i:type="d:string">000000000000000</deviceIMEI>
<deviceDDI i:type="d:string">us</deviceDDI>
<deviceNumber i:type="d:string">15555215554</deviceNumber>
</n0:SBPublish.getToken>
</v:Body>
</v:Envelope>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:smspublish.aldeiati.com">
   <SOAP-ENV:Body>
      <ns1:SBPublish.getTokenResponse xmlns:ns1="urn:smspublish.aldeiati.com">
         <return xsi:type="tns:Token">
            <token xsi:type="xsd:string">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</token>
            <expireIn xsi:type="xsd:long">180000</expireIn>
            <status xsi:type="xsd:int">authorized</status>
            <error xsi:type="xsd:int">200</error>
         </return>
      </ns1:SBPublish.getTokenResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
httpTransportSE.call(WS_METHOD_POLL_SERVER, envelope);