我在我的 iphone 应用程序中使用 asp.net webservices 我正在创建消息,例如
-(NSString *)createChangePasswordMessage:(NSString *)oldPassword withNewPassword:(NSString *)newPassword withUserID:(int)integer{
NSString *soapMessage=@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<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/\">\n"
"<soap:Body>\n"
"<UserID>%i</UserID>\n"
"<OldPassword>%@</OldPassword>\n"
"<NewPassword>%@</NewPassword>\n"
"</soap:Body>\n"
"</soap:Envelope>";
soapMessage=[NSString stringWithFormat:soapMessage,integer,oldPassword,newPassword];
return soapMessage;
}
但现在我必须在以下网络服务中传递对象
<xs:element name="UpdateSysUser">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" name="user" nillable="true" type="q9:SysUser" xmlns:q9="http://schemas.datacontract.org/2004/07/MyPass.DAL.DataCtx"/>
</xs:sequence>
</xs:complexType>
</xs:element>
所以我不知道如何为这个网络服务创建消息我创建了一个具有以下元素的类
<xs:complexType name="SysUser">
<xs:sequence>
<xs:element minOccurs="0" name="AccStatus" nillable="true" type="xs:unsignedByte"/>
<xs:element minOccurs="0" name="CityID" nillable="true" type="xs:long"/>
<xs:element minOccurs="0" name="CountryID" nillable="true" type="xs:int"/>
<xs:element minOccurs="0" name="Individuals" nillable="true" type="tns:ArrayOfIndividual"/>
<xs:element minOccurs="0" name="NickName" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="NickPrivacyID" nillable="true" type="xs:unsignedByte"/>
<xs:element minOccurs="0" name="Password" nillable="true" type="xs:string"/>
<xs:element minOccurs="0" name="UserID" type="xs:long"/>
<xs:element minOccurs="0" name="UserTypeID" type="xs:unsignedByte"/>
请帮助我如何为上述网络服务创建消息,以便我可以从中传递 SysUser 对象。