2013-05-28 9 views
8

エンタープライズアプリケーションでWSLD2OBJCを使用してSOAPベースのサービスを使用する予定です。しかしwsdl2objcのための最後の更新は2010年soap with IOSを使用する

  1. にあったwsdl2objcは、エンタープライズアプリケーションで使用しても安全ですか?
  2. 石鹸の解析に信頼できる他のコンポーネントはありますか?
  3. 、またはNSXMLParseで平易なXMLリクエストを使用できますか?
+0

バックエンドで.NET、PHP、またはRubyを使用する予定ですか?なぜRESTではなくSOAPを使用したいのですか? –

+0

バックエンドは.NETにあります。 –

答えて

2

まず第一に、WSLD2OBJCは、一般的には)

1を使用するにはあまりにも肥大化しているメッセージは暗号化されていない場合、SOAP自体は安全ではありません。あなたはSOAP v1.0を持つ.NETで属性[WebMethod]を使用する場合someSOAPmethodからこのSOAPボディを考慮:

POST /WebService/Common.asmx HTTP/1.1 
Host: localhost 
Content-Type: text/xml; charset=utf-8 
Content-Length: length 
SOAPAction: "http://example.com/someSOAPmethod" 
<?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> 
    <SomeSOAPmethod xmlns=\"http://example.com/\"> 
    <encryptedMessage>%@</encryptedMessage> //<-- this is vary, depends on your parameter 
    </SomeSOAPmethod> 
</soap:Body> 
</soap:Envelope> 

% @をSOAPを確保するencrypedデータを渡しておく必要があります。どんなタイプの暗号化でも使用できますが、私はAESを好きです。さらに安全にHTTPS接続(RSA暗号化)を追加します。

2)WSLD2OBJCを使用する代わりに、独自の構文解析を構築できます。 の一部からいくつかの方法を使用して。上記の方法を使用する方法

-(NSMutableURLRequest *)encapsulateSOAP:(NSString *)encryptedMessage withSoapMethod:(NSString *)soapMethod andBaseURL:(NSURL *)baseURL 
{ 

    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><%@ xmlns=\"http://example.com/\"><encryptedMessage>%@</encryptedMessage></%@></soap:Body></soap:Envelope>", soapMethod, encryptedMessage, soapMethod]; 


    NSString* msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]]; 

    NSMutableURLRequest* theRequest = [NSMutableURLRequest requestWithURL:baseURLl]; 
    [theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; 
    [theRequest addValue:[NSString stringWithFormat:@"%@%@", @"http://example.com/", soapMethod ] forHTTPHeaderField:@"SOAPAction"]; 
    [theRequest setHTTPMethod:@"POST"]; 
    [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"]; 
    [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]]; 
    [theRequest setTimeoutInterval:10]; 

    return theRequest; 
} 

NSString *encryptedMessage = //some encrypted message 
    NSString *soapMethod = @"someSOAPmethod"; 
    NSURL *baseURL = [NSURL urlWithString:@"http://example.com"]; 
    NSMutableURLRequest *requestQueue = [self encapsulateSOAPRequest:encryptedMessage withSoapMethod:soapMethod andBaseURL:baseURL]; 
    //then request using AFNetworking, ASIHTTP or your own networking library 

3)はい、あなたは、SOAP要求またはアンバインドSOAP応答をバインドするNSXMLParseまたはあなたが好きなサードパーティのライブラリを使用することができます。

+0

私が示した上記の例は、リクエストメソッドのみでした。 –

+0

ありがとう..私はこれを試してみます –