来自 ios 的 soap Web 服务中请求的数据为空

requested data getting null in soap web service from ios

我正在尝试使用 Swift 代码通过来自 IOS 的 SOAP XML Web 服务将数据插入 SQL 服务器数据库,但它仅获取 ID 值这是在数据库中自动生成的,但我无法将我的数据插入 table,因为它会得到我在 Soap 消息中传递的空值。

我的代码在 swift

<?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>
     <CreateUserDetail xmlns='http://tempuri.org/'>
        <userdetail>
           <UserDetail>
              <Id>1</Id>
              <Username xsi:type='xs:string'>username</Username>
              <Password xsi:type='xs:string'>password</Password>
           </UserDetail>
       </userdetail>
    </CreateUserDetail>
 </soap:Body>
</soap:Envelope>

I have surfing many of blog and sites and finally I got solution for it here is a soap message with solution

my new soap message is written below

<SOAP-ENV:Envelope xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:tns='http://tempuri.org/' xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'>
<SOAP-ENV:Header/>
     <SOAP-ENV:Body>
         <tns:CreateUserDetail>
            <tns:userdetail>
                <tns:Id xmlns:tns='http://schemas.datacontract.org/2004/07/WcfService1'>1</tns:Id>
                <tns:Username xmlns:tns='http://schemas.datacontract.org/2004/07/WcfService1'>String</tns:Username>
                <tns:Password xmlns:tns='http://schemas.datacontract.org/2004/07/WcfService1'>String</tns:Password>
           </tns:userdetail>
       </tns:CreateUserDetail>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

you have to just replace xmlns:tns='your target namespace' which i have write in id,username,password element

hope it will help someone