{"action":"created","issue":{"url":"https://api.github.com/repos/priore/SOAPEngine/issues/124","repository_url":"https://api.github.com/repos/priore/SOAPEngine","labels_url":"https://api.github.com/repos/priore/SOAPEngine/issues/124/labels{/name}","comments_url":"https://api.github.com/repos/priore/SOAPEngine/issues/124/comments","events_url":"https://api.github.com/repos/priore/SOAPEngine/issues/124/events","html_url":"https://github.com/priore/SOAPEngine/issues/124","id":171455686,"number":124,"title":"TagPrefixes","user":{"login":"Brandon-T","id":1530031,"avatar_url":"https://avatars.githubusercontent.com/u/1530031?v=3","gravatar_id":"","url":"https://api.github.com/users/Brandon-T","html_url":"https://github.com/Brandon-T","followers_url":"https://api.github.com/users/Brandon-T/followers","following_url":"https://api.github.com/users/Brandon-T/following{/other_user}","gists_url":"https://api.github.com/users/Brandon-T/gists{/gist_id}","starred_url":"https://api.github.com/users/Brandon-T/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Brandon-T/subscriptions","organizations_url":"https://api.github.com/users/Brandon-T/orgs","repos_url":"https://api.github.com/users/Brandon-T/repos","events_url":"https://api.github.com/users/Brandon-T/events{/privacy}","received_events_url":"https://api.github.com/users/Brandon-T/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-16T16:12:22Z","updated_at":"2016-08-16T17:41:35Z","closed_at":null,"body":"I need to send a request with the following payload:\r\n\r\n```objective-c\r\n[self.engine requestURL:@\"http://serviceurlhere.com/service.asmx\" soapAction:@\"https://serviceurlhere.com/SOAPAction\" completeWithDictionary:^(NSInteger statusCode, NSDictionary *dict) {\r\n        \r\n    } failWithError:^(NSError *error) {\r\n        \r\n    }];\r\n```\r\n\r\n```xml\r\n<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:pos=\"https://my-url-here/namespace\">\r\n\t<soapenv:Header>\r\n\t\t<prefix:AuthHeader>\r\n\t\t\t<prefix:Username>Username</prefix:Username>\r\n\t\t\t<prefix:Password>Password</prefix:Password>\r\n\t\t</prefix:AuthHeader>\r\n\t</soapenv:Header>\r\n\t<soapenv:Body>\r\n\t\t<prefix:AccountInfo>\r\n\t\t\t<AccountInquiryMessage>\r\n\t\t\t\t<AccountNumber>AccountNumberHere</AccountNumber>\r\n\t\t\t</AccountInquiryMessage>\r\n\t\t</prefix:AccountInfo>\r\n\t</soapenv:Body>\r\n</soapenv:Envelope>\r\n```\r\n\r\n\r\nUsing the SOAPEngine, I can't get it to prefix the ROOT tag in the body..\r\n\r\nI had to do:\r\n\r\n```objective-c\r\n- (NSMutableURLRequest*)soapEngine:(SOAPEngine*)soapEngine didBeforeSendingURLRequest:(NSMutableURLRequest*)request {\r\n    \r\n    NSString *xmlString = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding];\r\n    \r\n    for (NSString *tag in self.tagsToReplace) {\r\n        NSRegularExpression *expr = [[NSRegularExpression alloc] initWithPattern:[NSString stringWithFormat:@\"<%@\\\\sxmlns.*?>\", tag] options:0 error:nil];\r\n        \r\n        xmlString = [expr stringByReplacingMatchesInString:xmlString options:0 range:NSMakeRange(0, xmlString.length) withTemplate:[NSString stringWithFormat:@\"<prefix:%@>\", tag]];\r\n        \r\n        xmlString = [xmlString stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@\"</%@>\", tag] withString:[NSString stringWithFormat:@\"</prefix:%@>\", tag]];\r\n    }\r\n    \r\n    [request setHTTPBody:[xmlString dataUsingEncoding:NSUTF8StringEncoding]];\r\n    return request;\r\n}\r\n```\r\n\r\nBy root tag, I mean the \"AccountInfo\" tag. Is there really no way to prefix the tags or specify which tags should be prefixed? There should be a way to prefix at least the root tag within the body tag.\r\n\r\nEven for the header tags, I had to prefix them myself and set the header. Is there something I'm missing?"},"comment":{"url":"https://api.github.com/repos/priore/SOAPEngine/issues/comments/240179615","html_url":"https://github.com/priore/SOAPEngine/issues/124#issuecomment-240179615","issue_url":"https://api.github.com/repos/priore/SOAPEngine/issues/124","id":240179615,"user":{"login":"priore","id":1537350,"avatar_url":"https://avatars.githubusercontent.com/u/1537350?v=3","gravatar_id":"","url":"https://api.github.com/users/priore","html_url":"https://github.com/priore","followers_url":"https://api.github.com/users/priore/followers","following_url":"https://api.github.com/users/priore/following{/other_user}","gists_url":"https://api.github.com/users/priore/gists{/gist_id}","starred_url":"https://api.github.com/users/priore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/priore/subscriptions","organizations_url":"https://api.github.com/users/priore/orgs","repos_url":"https://api.github.com/users/priore/repos","events_url":"https://api.github.com/users/priore/events{/privacy}","received_events_url":"https://api.github.com/users/priore/received_events","type":"User","site_admin":false},"created_at":"2016-08-16T17:41:35Z","updated_at":"2016-08-16T17:41:35Z","body":"Usually the soapAction parameter no has a prefix, as in your case prefix:AccountInfo, usually is enough to pass http://your-address/AccountInfo and this construct a xml body like this:\r\n\r\n```xml\r\n<soapenv:Body>\r\n        <AccountInfo xmlns=\"http://your-address\">\r\n            <AccountInquiryMessage>\r\n                <AccountNumber>AccountNumberHere</AccountNumber>\r\n            </AccountInquiryMessage>\r\n        </AccountInfo>\r\n</soapenv:Body>\r\n```\r\n\r\nin this case the \"prefix\" is replaced automatically with xmlns = \"http: // your-address\", this is the correct way, you don't need use \"prefix:\" in the body, and you do not need to set a custom SOAPAction in header request, this is set automatically."}}
{"actor":{"display_login":"priore"}}