मैं आईओएस एप्लिकेशन से .NET ASMX सेवा का आह्वान करना चाहता हूं। मैं इस तरह मेरे SOAP संदेश बनाया:आईओएस एप्लिकेशन से एसओएपी एएसएमएक्स सेवा में पैरामीटर्स भेजना
-(IBAction)submitButtonClicked:(id)sender
{
NSURL *url = [NSURL URLWithString:@"http://127.0.0.1:8080/NotificationService.asmx"];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setRequestMethod:@"POST"];
[request addRequestHeader:@"Content-Type" value:@"text/xml; charset=utf-8"];
[request addRequestHeader:@"SOAPAction" value:@"http://tempuri.org/HelloWorld"];
NSString *soapMessage = [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>"
"<Greet xmlns=\"http://tempuri.org/\">"
"<deviceToken>some device token</deviceToken>"
"<userName>azamsharp</userName>"
"</Greet>"
"</soap:Body>"
"</soap:Envelope>"];
NSString *messageLength = [NSString stringWithFormat:@"%d",[soapMessage length]];
[request addRequestHeader:@"Content-Length" value:messageLength];
[request appendPostData:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
[request setDelegate:self];
[request startAsynchronous];
}
ऊपर कोड काम करता है, लेकिन जैसा कि आप देख सकते हैं मैं मैन्युअल सोप संदेश बनाने के लिए किया है। क्या पैरामीटर में प्रवेश करने का कोई तरीका है और विधि का नाम और साबुन निकाय/संदेश स्वचालित रूप से बनाया गया है। एक ही सटीक परिदृश्य के लिए StackOverFlow पर एक उदाहरण था लेकिन मैं इसे खोजने में सक्षम नहीं हूं।
क्या आपके पास इसके साथ कोई भाग्य है? – zaitsman
@zaitsman, मैंने अभी जवाब दिया है कि एक उत्तर पर एक नज़र डालें ... सब कुछ दिनांकित लेकिन यह आपकी मदद कर सकता है? – Purpletoucan