Iphone 传递给WSDL生成代码的空对象
我使用SOAP服务和WSDL2OBJ工具为我的web服务生成代码。 我正在使用以下代码将参数传递给服务,但它会将Emply数据包发送给我的服务 问题是什么 //下面是我在OBJ-C中用来发送数据包的代码 Qula_x0020_WebServiceSoapBinding*绑定=[[Qula_x0020_WebService Qula_x0020_WebServiceSoapBinding]initWithAddress:@“URL”]; binding.logXMLInOut=YES; //Qula_x0020_WebService_ws_LoginInfo*LoginInfo=[]Iphone 传递给WSDL生成代码的空对象,iphone,soap,Iphone,Soap,我使用SOAP服务和WSDL2OBJ工具为我的web服务生成代码。 我正在使用以下代码将参数传递给服务,但它会将Emply数据包发送给我的服务 问题是什么 //下面是我在OBJ-C中用来发送数据包的代码 Qula_x0020_WebServiceSoapBinding*绑定=[[Qula_x0020_WebService Qula_x0020_WebServiceSoapBinding]initWithAddress:@“URL”]; binding.logXMLInOut=YES; //Qul
Qula_x0020_WebService_Login *parms = [[Qula_x0020_WebService_Login alloc] init];
[[parms LoginInfo] setEMAIL:@"username"];
[[parms LoginInfo] setPASSWORD:@"pasword"];
[[parms DeviceInfo] setMODEL:@"model"];
[[parms DeviceInfo] setDEVICE_TIME:@"time"];
[binding LoginAsyncUsingParameters:parms delegate:self];
下面是我的Web服务的XML:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:qula="url/">
<soap:Header/>
<soap:Body>
<qula:Login>
<qula:LoginInfo>
<qula:EMAIL>?</qula:EMAIL>
<qula:PASSWORD>?</qula:PASSWORD>
</qula:LoginInfo>
<qula:DeviceInfo>
<qula:MODEL>?</qula:MODEL>
<qula:DEVICE_TIME>?</qula:DEVICE_TIME>
</qula:DeviceInfo>
</qula:Login>
</soap:Body>
</soap:Envelope>
?
?
?
?
我的Obj-C请求生成的XML如下:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:Qula_x0020_WebService="http://qula.sigmatec.com.pk/" xsl:version="1.0">
<soap:Body>
<Qula_x0020_WebService:Login/>
</soap:Body>
</soap:Envelope>
谁能帮帮我吗。我在这里结巴了(当我用soap消息发送数据时,我将向您展示如何处理数据,也许这会有所帮助
NSString*conduitPath=[NSString stringWithFormat:@”http://yourwebservicename“,服务器IP];
NSURL*url=[NSURL URLWithString:conduitPath];
NSMutableURLRequest*请求=[NSMutableUrlRequestRequestWithURL:url];
NSString*soapmsg=[NSString stringWithFormat:
@""
""
""
""
"%@"
"%@"
"%@"
"%@"
"%@"
""
""
“”,self.userNameTxt.text,self.passwordTxt.text,self.nameTxt.text,self.emailTxt.text,self.mobileTxt.text];
NSString*msgLength=[NSString stringWithFormat:@“%d”,[soapmsg长度]];
[请求addValue:@“text/xml;charset=utf-8”用于HttpHeaderField:@“内容类型”];
[请求添加值:@”http://tempuri.org/registrationforHTTPHeaderField:@“SOAPAction”];
[请求添加值:msgLength forHTTPHeaderField:@“内容长度”];
[请求设置HttpMethod:@“POST”];
[请求setHTTPBody:[soapmsg dataUsingEncoding:NSUTF8StringEncoding];
conn=[[NSURLConnection alloc]initWithRequest:request委托:self];
如果(康涅狄格州)
{
webData=[[NSMutableData]保留];
}
之后,实现NSURLConnection委托方法以确保成功加载连接。但是我们可以从该envolpe传递对象吗
NSString *conduitPath = [NSString stringWithFormat:@"http://yourwebservicename",serverIP];
NSURL *url = [NSURL URLWithString:conduitPath];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
NSString *soapmsg = [NSString stringWithFormat:
@"<?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>"
"<registration xmlns=\"http://tempuri.org/\">"
"<username>%@</username>"
"<password>%@</password>"
"<name>%@</name>"
"<email>%@</email>"
"<mobile>%@</mobile>"
"</registration>"
"</soap:Body>"
"</soap:Envelope>",self.userNameTxt.text,self.passwordTxt.text,self.nameTxt.text,self.emailTxt.text,self.mobileTxt.text];
NSString *msgLength = [NSString stringWithFormat:@"%d",[soapmsg length]];
[request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"http://tempuri.org/registration" forHTTPHeaderField:@"SOAPAction"];
[request addValue:msgLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[soapmsg dataUsingEncoding:NSUTF8StringEncoding]];
conn = [[NSURLConnection alloc]initWithRequest:request delegate:self];
if(conn)
{
webData = [[NSMutableData data]retain];
}