Acess php webservice из приложения для Android

Я пытаюсь получить доступ к php-веб-сервису из моего приложения для Android. Но это выдает эту ошибку`.inputStreamReader@4052d300) " . Это мой wsdl файл

 <?xml version ='1.0' encoding ='UTF-8' ?>

<definitions 
name='product' 
targetNamespace='urn:PHP_SOAP_RPC' 
xmlns:tns='urn:PHP_SOAP_RPC' 
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
xmlns:xsd='http://www.w3.org/2001/XMLSchema' 
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' 
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' 
xmlns='http://schemas.xmlsoap.org/wsdl/'>  

 <message name='gettestRequest'>
<part name='id' type='xsd:string'/>
</message>
<message name='gettestRespones'>
<part name='id' type='xsd:string'/>
</message>

<portType name='productPortType'>               
    <operation name='gettest'> 
    <input message='tns:gettestRequest'/> 
    <output message='tns:gettestRespones'/> 
    </operation>         
</portType>
 <binding name='productBinding' type='tns:productPortType'> 


    <soap:binding style='rpc' 
    transport='http://schemas.xmlsoap.org/soap/http'/>      

    <operation name='gettest'> 
        <soap:operation soapAction='urn:xmethods-delayed-quotes#gettest'/> 
        <input> 
        <soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </input> 
        <output> 
        <soap:body use='encoded' namespace='urn:xmethods-delayed-quotes' 
        encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/> 
        </output> 
    </operation>    
</binding>

<service name='product'> 
    <port name='productPortType' binding='productBinding'> 
    <soap:address location='http://111.223.189.236/webservice/server1.php'/> 
    </port> 
</service> 

и это мой файл Java

    String METHOD_NAME = "gettest";
    String NAME_SPACE = "urn:PHP_SOAP_RPC";
    String SOAP_ACTION = NAME_SPACE + METHOD_NAME;
    String URL = "http://111.223.189.236/webservice/shoppingcart.wsdl";


    SoapObject Request = new SoapObject(NAME_SPACE, METHOD_NAME);

    Request.addProperty("userId", "userId");


    SoapSerializationEnvelope soapEnvelop = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    // soapEnvelop.dotNet = true;
    soapEnvelop.setOutputSoapObject(Request);
    HttpTransportSE aht = new HttpTransportSE(URL);

    try {
        aht.call(SOAP_ACTION, soapEnvelop);
        SoapPrimitive resultString = (SoapPrimitive) soapEnvelop.getResponse();
        tv.setText(resultString.toString());

    } catch (Exception e) {
        tv.setText(e.toString());

}

это мой php файл

<?php

echo "ccc";

 function gettest($id) {    
return $id;
  }
      $server1 = new SoapServer(null, array('uri'=> "urn://tyler/res"));
  $server1->addFunction("gettest"); 
  $server1->handle(); 

   ?>

1 ответ

Измените ваш URL и удалите.wsdl, затем попробуйте также SoapPrimitive resultString = (SoapPrimitive) soapEnvelop.getResponse(); .не получить ответ использовать бодиин

Другие вопросы по тегам