使用powerbuilder 12.5调用web服务方法返回null响应

问题描述:

任何建议/解决方案/提示将不胜感激。使用powerbuilder 12.5调用web服务方法返回null响应

我使用PowerBuilder 12.5来调用.Net Web服务,并且调用工作正常,并且由发送有效XML响应的WS接收,但由PB加载时的响应对象为空。

代理项目正在使用.Net选项生成PB代理。一些WS方法工作正常,在PB代码中可以访问响应对象,但在调用某些其他WS方法时,即使响应XML正确且包含预期值(使用fiddler捕获),分配用于保存WS方法响应的PB对象也为null )。在视觉检查中,由PB生成的代理似乎与WSDL定义相匹配。

我需要能够在代码中检查WS方法调用的响应,以便应用程序在失败时可以采取适当的操作。

的WSDL是: http://cbre.truelogic.com.au/service.asmx?WSDL

例PB代码:

相同WS,第一方法调用GroupInsert()作品但虽然第二方法调用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>[email protected]</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响应:小提琴手捕获:

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> 

你并不需要创建得到由服务调用返回的结构的实例。所有你需要做的就是声明它 - 并将它填充为方法调用的返回值。

取出CREATE语句。

+0

嗨保罗,谢谢,但它没有区别。在两次WS方法调用之前,我尝试了使用和不使用create response object语句的代码。 GroupInsert()仍填充响应,但无论我是否使用create response object语句,BulkImport()都返回null。 – 2012-07-09 01:14:59