2014-10-21 3 views
0

Так что я получаю http error 404, указывающий, что я пытаюсь получить доступ к чему-то, чего там нет. Я не могу понять, что пропало или что я неправильно понял.SOAP от Android дает 404

  • Пространство имен: http://tempuri.org/
  • URL: http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc?wsdl
  • Действие: SetPulseOxi
  • Soap_action: http://tempuri.org/IPulseOxi/SetPulseOxi

Сервис мыло работает от SOAPUI, но не из моего ksoap2 Android реализации. Я также попробовал отправить raw SOAP, который, как я знаю, работал через SOAPUI.

Пример запроса от Android ksoap:

<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> 
     <SetPulseOxi xmlns="http://tempuri.org/"> 
      <DeviceID>test1</DeviceID> 
      <UnitID>test2</UnitID> 
     </SetPulseOxi> 
    </v:Body> 
</v:Envelope> 

Это полный WSDL:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" name="PulseOxiSvc" targetNamespace="http://tempuri.org/"> 
    <wsp:Policy wsu:Id="IPulseOxi_policy"> 
     <wsp:ExactlyOne> 
      <wsp:All> 
       <http:BasicAuthentication xmlns:http="http://schemas.microsoft.com/ws/06/2004/policy/http"/> 
      </wsp:All> 
     </wsp:ExactlyOne> 
    </wsp:Policy> 
    <wsdl:types> 
     <xsd:schema targetNamespace="http://tempuri.org/Imports"> 
      <xsd:import schemaLocation="http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc?xsd=xsd0" namespace="http://tempuri.org/"/> 
      <xsd:import schemaLocation="http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/> 
      <xsd:import schemaLocation="http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/WcfHomeCare"/> 
     </xsd:schema> 
    </wsdl:types> 
    <wsdl:message name="IPulseOxi_GetPulseOxiById_InputMessage"> 
     <wsdl:part name="parameters" element="tns:GetPulseOxiById"/> 
    </wsdl:message> 
    <wsdl:message name="IPulseOxi_GetPulseOxiById_OutputMessage"> 
     <wsdl:part name="parameters" element="tns:GetPulseOxiByIdResponse"/> 
    </wsdl:message> 
    <wsdl:message name="IPulseOxi_GetAllPulseOxi_InputMessage"> 
     <wsdl:part name="parameters" element="tns:GetAllPulseOxi"/> 
    </wsdl:message> 
    <wsdl:message name="IPulseOxi_GetAllPulseOxi_OutputMessage"> 
     <wsdl:part name="parameters" element="tns:GetAllPulseOxiResponse"/> 
    </wsdl:message> 
    <wsdl:message name="IPulseOxi_SetPulseOxi_InputMessage"> 
     <wsdl:part name="parameters" element="tns:SetPulseOxi"/> 
    </wsdl:message> 
    <wsdl:message name="IPulseOxi_SetPulseOxi_OutputMessage"> 
     <wsdl:part name="parameters" element="tns:SetPulseOxiResponse"/> 
    </wsdl:message> 
    <wsdl:portType name="IPulseOxi"> 
     <wsdl:operation name="GetPulseOxiById"> 
      <wsdl:input wsaw:Action="http://tempuri.org/IPulseOxi/GetPulseOxiById" message="tns:IPulseOxi_GetPulseOxiById_InputMessage"/> 
      <wsdl:output wsaw:Action="http://tempuri.org/IPulseOxi/GetPulseOxiByIdResponse" message="tns:IPulseOxi_GetPulseOxiById_OutputMessage"/> 
     </wsdl:operation> 
     <wsdl:operation name="GetAllPulseOxi"> 
      <wsdl:input wsaw:Action="http://tempuri.org/IPulseOxi/GetAllPulseOxi" message="tns:IPulseOxi_GetAllPulseOxi_InputMessage"/> 
      <wsdl:output wsaw:Action="http://tempuri.org/IPulseOxi/GetAllPulseOxiResponse" message="tns:IPulseOxi_GetAllPulseOxi_OutputMessage"/> 
     </wsdl:operation> 
     <wsdl:operation name="SetPulseOxi"> 
      <wsdl:input wsaw:Action="http://tempuri.org/IPulseOxi/SetPulseOxi" message="tns:IPulseOxi_SetPulseOxi_InputMessage"/> 
      <wsdl:output wsaw:Action="http://tempuri.org/IPulseOxi/SetPulseOxiResponse" message="tns:IPulseOxi_SetPulseOxi_OutputMessage"/> 
     </wsdl:operation> 
    </wsdl:portType> 
    <wsdl:binding name="IPulseOxi" type="tns:IPulseOxi"> 
     <wsp:PolicyReference URI="#IPulseOxi_policy"/> 
     <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> 
     <wsdl:operation name="GetPulseOxiById"> 
      <soap:operation soapAction="http://tempuri.org/IPulseOxi/GetPulseOxiById" style="document"/> 
      <wsdl:input> 
       <soap:body use="literal"/> 
      </wsdl:input> 
      <wsdl:output> 
       <soap:body use="literal"/> 
      </wsdl:output> 
     </wsdl:operation> 
     <wsdl:operation name="GetAllPulseOxi"> 
      <soap:operation soapAction="http://tempuri.org/IPulseOxi/GetAllPulseOxi" style="document"/> 
      <wsdl:input> 
       <soap:body use="literal"/> 
      </wsdl:input> 
      <wsdl:output> 
       <soap:body use="literal"/> 
      </wsdl:output> 
     </wsdl:operation> 
     <wsdl:operation name="SetPulseOxi"> 
      <soap:operation soapAction="http://tempuri.org/IPulseOxi/SetPulseOxi" style="document"/> 
      <wsdl:input> 
       <soap:body use="literal"/> 
      </wsdl:input> 
      <wsdl:output> 
       <soap:body use="literal"/> 
      </wsdl:output> 
     </wsdl:operation> 
    </wsdl:binding> 
    <wsdl:service name="PulseOxiSvc"> 
     <wsdl:port name="IPulseOxi" binding="tns:IPulseOxi"> 
      <soap:address location="http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc/WcfHomeCare"/> 
     </wsdl:port> 
    </wsdl:service> 
</wsdl:definitions> 

ответ

1

я не уверен, если это поможет или прорыв ... или просто ничего

, если вы изменили URL-адрес на http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc/WcfHomeCare с целевым http://tempuri.org/IPulseOxi/SetPulseOxi у меня получился результат (Android ksoap2) результат: Object reference not set to an instance of an object.

, если я использую в качестве меры http://tempuri.org/SetPulseOxi я получил 500 ответа , к сожалению, я не мог получить правильный ответ, по крайней мере URL вещь 100% прорыв.

здесь код я использовал:

final String NAMESPACE = "http://tempuri.org/"; 
    final String URL = "http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc/WcfHomeCare"; 
    String methodName = "SetPulseOxi"; 
    String soapAction = "http://tempuri.org/IPulseOxi/SetPulseOxi";//NAMESPACE + methodName; 

    SoapObject request = new SoapObject(NAMESPACE, methodName); 

    PropertyInfo hhh = new PropertyInfo(); 
    hhh.setName("DeviceID"); 
    hhh.setValue("testA"); 
    hhh.setType(String.class); 
    request.addProperty(hhh); 

    PropertyInfo ddd = new PropertyInfo(); 
    ddd.setName("UnitID"); 
    ddd.setValue("testB"); 
    ddd.setType(String.class); 
    request.addProperty(ddd); 

    PropertyInfo asas = new PropertyInfo(); 
    asas.setName("UserID"); 
    asas.setValue("1"); 
    asas.setType(String.class); 
    request.addProperty(asas); 

    PropertyInfo jkjk = new PropertyInfo(); 
    jkjk.setName("pulse_avg"); 
    jkjk.setValue("1"); 
    jkjk.setType(String.class); 
    request.addProperty(jkjk); 

    PropertyInfo location = new PropertyInfo(); 
    location.setName("pulse_max"); 
    location.setValue("1"); 
    location.setType(String.class); 
    request.addProperty(location); 

    PropertyInfo xx = new PropertyInfo(); 
    xx.setName("pulse_min"); 
    xx.setValue("1"); 
    xx.setType(String.class); 
    request.addProperty(xx); 

    PropertyInfo yy = new PropertyInfo(); 
    yy.setName("spO2_avg"); 
    yy.setValue("1"); 
    yy.setType(String.class); 
    request.addProperty(yy); 

    PropertyInfo as = new PropertyInfo(); 
    as.setName("spO2_max"); 
    as.setValue("1"); 
    as.setType(String.class); 
    request.addProperty(as); 

    PropertyInfo ff = new PropertyInfo(); 
    ff.setName("spO2_min"); 
    ff.setValue("1"); 
    ff.setType(String.class); 
    request.addProperty(ff); 

    PropertyInfo tt = new PropertyInfo(); 
    tt.setName("uid"); 
    tt.setValue("1"); 
    tt.setType(String.class); 
    request.addProperty(tt); 

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); 
    envelope.dotNet = true; 
    envelope.setOutputSoapObject(request); 

    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL, 15000); 
    androidHttpTransport.debug=true; 
    try { 
     androidHttpTransport.call(soapAction, envelope); 
     String result = envelope.getResponse().toString() ; 
     Log.i("YAZAN", result); 

    } catch (IOException e) { 
     e.printStackTrace(); 
    } catch (XmlPullParserException e) { 
     e.printStackTrace(); 
    } 

** плз игнорировать свойство глупые имена :) **

желаю вам удачи, если это помогло вам, пожалуйста, пометить как ответ :)

Подробнее: если вы открываете http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc?wsdl идти вниз до конца файла, вы увидите это

<wsdl:service name="PulseOxiSvc"> 
<wsdl:port name="IPulseOxi" binding="tns:IPulseOxi"> 
<soap:address location="http://testnet.medisat.dk:81/WcfHomeCare/PulseOxiSvc.svc/WcfHomeCare"/> 
</wsdl:port> 
</wsdl:service> 

как вы можете видеть местоположение = «HTTP: //.../WcfHomeCare» я работал с SOAP услугами раньше, но место было таким же, как URL , так что я не уверен, если это что-то необязательное установить другой URL-адрес для местоположения или он основан на конкретных потребностях.

оттуда, я думаю, что остальная часть истории твоя :)

+1

помеченная +1, как я могу на самом деле получить ввод сейчас, я просто должны убедиться, что все работает как надо. – Warpzit

+0

Спасибо, ты действительно помог, можешь объяснить, как ты узнал? И для будущих записей, как я должен был сказать, что мне пришлось добавить лишний путь? Я знаю, что ошибка указала на то, что это была проблема, но как выяснить, какой должен быть правильный путь? – Warpzit

+0

СПАСИБО!, хорошо, как я это сделал, я посмотрел на адрес SoapUI после добавления службы, поэтому я увидел новый URL-адрес, мое любопытство подтолкнуло меня к тому, чтобы узнать, как именно мы разобрались в этом URL-адресе, я подумал, что это нужно упомянуть где-то, WSDL, поэтому я отправился туда и нашел тот же URL-адрес, я отредактирую ответ, чтобы добавить подробности – Yazan

Смежные вопросы