iPhone アプリと通信する .NET WCF サービスがあります。すべての SOAP マジックに必要な objc コードを生成するために wsdl2objc を使用しています。SoapUI は、このサービスの wsdl を追加し、リクエストを正しく送信できます。しかし、 wsdl2objc によって生成されたリクエストは、これについて不平を言っています:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
<s:Body>
<s:Fault>
<s:Code>
<s:Value>s:Sender</s:Value>
<s:Subcode>
<s:Value xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</s:Value>
</s:Subcode>
</s:Code>
<s:Reason>
<s:Text xml:lang="en-US">The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
</s:Text>
</s:Reason>
</s:Fault>
</s:Body>
</s:Envelope>
ただし、s:Envelope
SoapUI で同じものを使用すると、リクエストは正しく機能します。私が見る限り、2 つのリクエストの唯一の違いは、wsdl2objc がこれを生成するヘッダー セクションです。
SOAPAction:http://xx/AuthenticateDevice
しかし、soapUI は以下を生成します。
Content-Type: application/soap+xml;charset=UTF-8;action="http://xx/AuthenticateDevice"
wsdl2objc が生成したコードを変更して、これを置き換えようとしました。
[request setValue:soapAction forHTTPHeaderField:@"SOAPAction"];
NSString *contentType = [NSString stringWithFormat:@"application/soap+xml; charset=utf-8;"];
[request setValue:contentType forHTTPHeaderField:@"Content-Type"];
これとともに:
[request setValue:soapAction forHTTPHeaderField:@"action"];
NSString *contentType = [NSString stringWithFormat:@"application/soap+xml; charset=utf-8;"];
[request setValue:contentType forHTTPHeaderField:@"Content-Type"];
しかし、今は 400 エラーが発生します。どんな助けでも大歓迎です!
ありがとう、
テジャ。