0

提案/解決策/ヒントは大歓迎です。

PowerBuilder 12.5 を使用して .Net Web サービスを呼び出しています。呼び出しは機能し、有効な XML 応答を送信する WS によって受信されますが、PB によってロードされたときの応答オブジェクトは null です。

プロキシ プロジェクトは .Net オプションを使用して PB プロキシを生成します。一部の WS メソッドは正常に動作し、応答オブジェクトは PB コードでアクセスできますが、他の WS メソッドの一部を呼び出すと、WS メソッドの応答を保持するために割り当てられた PB オブジェクトは、応答 XML が正しく、期待される値 (フィドラーを使用して取得) を含んでいても null になります。 )。目視検査では、PB によって生成されたプロキシは WSDL 定義と一致しているように見えます。

アプリケーションが失敗した場合に適切なアクションを実行できるように、コードで WS メソッド呼び出しの応答を確認できる必要があります。

WSDL は次のとおりです。 http://cbre.truelogic.com.au/service.asmx?WSDL

PB コードの例:

同じ WS、最初のメソッド呼び出しは機能しGroupInsert()ますが、2 番目のメソッド呼び出しはContactBulkImportWithGroups()機能しますが、PB はメソッド応答の解釈と応答オブジェクトの読み込みに失敗します (応答 XML が正しい場合でも)。

// Web Service = lws_cl, already created earlier in script.

// Get Group ID - This WS method call works
wspn_campaignlogic_group ln_ret_group
decimal ldc_groupID[1]

ln_ret_group = lws_cl.GroupInsert(ls_groupName)
if isValid(ln_ret_group.GroupResults) then
    if ln_ret_group.GroupResults.ResultCode = 1 then
        ldc_groupID[1] = ln_ret_group.GroupID
    end if
end if

// Contacts - This WS method returns null
wspn_campaignlogic_contactbulkimporter ln_ret_contact   
any la_xml

ln_ret_contact = create wspn_campaignlogic_contactbulkimporter

la_xml = '<contacts><c><f>Jill</f><l>Jackson</l><e>jj@yahoo.com</e><comp>Acme Solutions</comp><sal></sal><p>(02) 8080 1111</p><m></m></c></contacts>'
ln_ret_contact = lws_cl.ContactBulkImportWithGroups(3, ldc_groupID, la_xml, "dd/mm/yyyy")

// Check results
if NOT isValid(ln_ret_contact) then
    // Error - execution goes in here because ln_ret_contact is null so result cannot be checked by code
else
    // OK
end if

XML 応答: Fiddler によってキャプチャされました:

HTTP/1.1 200 OK
Date: Fri, 06 Jul 2012 04:39:42 GMT
Server: Microsoft-IIS/6.0
X-UA-Compatible: IE=8
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 688

<?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:Body><ContactBulkImportWithGroupsResponse xmlns="http://new.cl.truelogic.com.au/"><ContactBulkImportWithGroupsResult><ImportResults><InvalidContacts><contacts xmlns=""></contacts></InvalidContacts><Updated>1</Updated><Inserted>0</Inserted></ImportResults><ContactImportResults><ResultCode>1</ResultCode><ResultDescription>Success.</ResultDescription></ContactImportResults></ContactBulkImportWithGroupsResult></ContactBulkImportWithGroupsResponse></soap:Body></soap:Envelope>
4

1 に答える 1

0

サービス呼び出しによって返される構造体のインスタンスを作成する必要はありません。宣言するだけで、メソッド呼び出しからの戻り値として設定されます。

その CREATE ステートメントを取り出します。

于 2012-07-06T18:46:59.263 に答える