0

わかりました、これは一週間ずっと私を夢中にさせてきました。なぜこれが起こるのかについて簡単な説明が必要です. SOAP ASP.NET 2.0 Web サービスと通信する blackberry アプリケーションを作成しました。Web サービスは、セッション トークンを含むリクエストで SOAP ヘッダーを想定しています。

SOAP メッセージは次のとおりです。

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Header>
        <AuthenticationTicket xmlns="http://tempuri.org//">
            <DeviceId>c3a4fc48-ce59-43f0-ae48-3452b5df9f14</DeviceId>
            <UserId>00000000-0000-0000-0000-000000000000</UserId>
            <SessionId>F432F463D5A5613BDAFF1BB43264D40A20F691F397F7248F92424D5BE2E8A9DFC888C8418CEFEB84BA4A9FE203B02542C926B98D9C499389D91FE390D3D0D611EC2BC37BBE7AB21CA9533B9389075D417D5EDB82CB8D3E46680B17A6C9DE552CFBFBE86C84E96C20FB07BBCA373B456B8F2FDB9F711ADBA8DEF46222A96113559CEAB4AE41EA44B52BDEC1AAF5FA7598256859F60D1F5615AD35B47C5EA23D8019E0690C463330503D4F3026575BE04CE341D89A63770930569153D9523D6733C3B831C56824B94EFD696A83BB9C4DD93817BDCA299F20CD7CCEC479F6267A09A03AD3C025DBDEC3B8F49402DE1B6538</SessionId>
        </AuthenticationTicket>
    </soap:Header>
    <soap:Body>
        <Retrieve xmlns="https://mobile.southeasthealth.com/">
            <Request xsi:type="CallListRequest">
                <Type>CallList</Type>
                <DeviceId>00000000-0000-0000-0000-000000000000</DeviceId>
                <UserName>XXXX</UserName>
            </Request>
        </Retrieve>
    </soap:Body>
</soap:Envelope>

メッセージを送信するために使用しているコードは次のとおりです。

String url = app.getProtocol() + "://" + app.getHost() + (app.getPort() == 80 || app.getPort() == 443 ? "" : app.getPort()) + "/" + app.getService();

URL address = new URL(url);

TrustManagerManipulator.allowAllSsl();

URLConnection connection = address.openConnection();
HttpsURLConnection post = (HttpsURLConnection)connection;
post.setDoInput(true);
post.setDoOutput(true);
post.setRequestMethod("POST");
post.setRequestProperty("SOAPAction", app.getNamespace() + "/Retrieve");
post.setRequestProperty("Content-Type", "text/xml; charset=utf-8");
post.setRequestProperty("Content-Length", String.valueOf(postData.toString().length()));
post.setReadTimeout(30000);

OutputStream outStream = post.getOutputStream();
Writer out = new OutputStreamWriter(outStream);
out.write(postData.toString());
out.flush();
out.close();

私が遭遇する問題は、リクエストが Web サービスで受信されたときに、メッセージに SOAP ヘッダーが含まれていないことです。

他の誰かがこの問題に遭遇しましたか?

よろしくお願いします。ニール

- - - アップデート - - -

わかったので、メッセージを見直して WSDL と比較し、SOAPUI を介してメッセージを実行しました。Android で同じコードが問題なく動作することがわかりました。

私はついにそれが名前空間に帰着したことを発見しました

<AuthenticationTicket xmlns="http://tempuri.org//">

上記の名前空間には末尾に 2 つの // があり、これは WSDL 定義と一致しません。これを次のように変更しました

<AuthenticationTicket xmlns="http://tempuri.org/">

そして、すべてが機能し始めました。

Blackberry は有効な SOAP について Android よりも少しうるさいようです。

私はそれを見つけたはずです!!

4

0 に答える 0