简体   繁体   中英

Soap web service and android client using ksoap protocal mismatch

I have and android client, that uses ksoap to communicate with a wsdl web service written in c# asp.net. I have a problem with matching the argument types between the web service and the client. The web server expects to this kind of request (auto generated):

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetDetails xmlns="http://host.org/">
      <event_id>int</event_id>
    </GetDetails>
  </soap:Body>
</soap:Envelope>

the client sends requests using ksoap, and they look like this:

<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:GetDetails id="o0" c:root="1" xmlns:n0="http://tempuri.org">
              <event_id i:type="d:int">1</event_id>
           </n0:GetDetails>
       </v:Body>
</v:Envelope>

For some reason the WS parses the following' client's request as 0 (I guess because of the additional type attributes - i:type="d:int") when the request is assembled manually to look like the first option, it works correctly. How can i make the web service read the ksoap format correctly or how can i change it's expected format to look like ksoap request. (the web service soap protocol is auto generated).

Well the solution has 2 parts: 1. regarding removing the attribute types, I found the answer here: using addMapping without the "i:type=" attribute in ksoap2 for android I neede to set:

envelope.implicitTypes = true;
  1. The name space has to end with a backspace, and i missed it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM