-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEZSoapMessageBuilder.m
51 lines (42 loc) · 1.51 KB
/
EZSoapMessageBuilder.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// EZSoapMessageBuilder.m
//
// Created by Mike Brockey on 10/24/08.
//
#import "EZSoapMessageBuilder.h"
@implementation EZSoapMessageBuilder
+(NSString*)messageWithAction:(NSString*)soapAction
{
NSString *envelope = @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">"
"<soap12:Body>"
"<%@ xmlns=\"http://tempuri.org/\" />"
"</soap12:Body>"
"</soap12:Envelope>";
return [NSString stringWithFormat:envelope, soapAction];
}
+(NSString*)messageWithAction:(NSString*)soapAction ParamsWithString:(NSString*)paramString
{
NSString *envelope = @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">"
"<soap12:Body>"
"<%@ xmlns=\"http://tempuri.org/\">"
"%@"
"</%@>"
"</soap12:Body>"
"</soap12:Envelope>";
return [NSString stringWithFormat:envelope, soapAction, paramString, soapAction];
}
+(NSString*)messageWithAction:(NSString*)soapAction ParamsWithDictionary:(NSDictionary*)paramDict
{
NSString* builder = @"";
if(paramDict != nil)
{
for (id key in paramDict)
{
builder = [builder stringByAppendingFormat:@"<%@>%@</%@>", key, [paramDict objectForKey:key], key];
}
}
return [EZSoapMessageBuilder messageWithAction:soapAction ParamsWithString:builder];
}
@end