PowerBuilder, Ruby consume WCF service

Wcf Test Client tool shipped with SDK (C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\WcfTestClient.exe) is very useful, looks like the WCF request and response is soap-like message passed around. But I have to publish to a real soap web service to enable other language consume Wcf Service, adding an extra endpoint using basicHttpBinding:

<endpoint address=”soap” binding=”basicHttpBinding” contract=”WcfServices.Contracts.ILookupServiceContract” />

Note: I attended a webinar recently about PB12 beta, it will support wsHttpBinding.

My PowerBuilder client can consume this WCF/Soap webservice now:

  1. Add pbwsclientXXX.pbd to lib list.
  2. Use Web Service proxy wizard, generate local proxy for powerbuilder. (My VMWare environment caused lots of trouble, watch out your firewall/router/http proxy) By adding host into ignore list of IE6, I fixed the wsdl not access problem, but still can’t fix out the same problem on VMWare and IE7.
  3. Code like this:
    soapconnection gnv_con
    gnv_con = create soapconnection
    wcflookupservice lnv_lookup
    gnv_con.createinstance( lnv_lookup, 'wcflookupservice' )
    any list[]
    string email_roles[]
    list = lnv_lookup.FetchAllEmailRoles( )
    email_roles = list
    int i
    for i = 1 to UpperBound(email_roles)
    lb_1.additem( email_roles[i] )

Ruby client can use SOAP::WSDLDriverFactory, example can be found at RESTful Web Services, or this post.  I kept getting “400 Bad Request” error, looked into the request envelope, it turns out I need to force Ruby running in Unicode mode, to change the KCode for XSD::Charset, run Ruby in ‘-Ku’ switch.

For Ruby, the return type from web service is always SOAP::Mapping::Object type.

To parse it, look into the output, for my case:

#<SOAP::Mapping::Object:0x423a8b2 {http://tempuri.org/}FetchAllEmailRolesResult=#<SOAP::Mapping::Object:0x423a7ae {http://schemas.microsoft.com/2003/10/Serialization/Arrays}string=[“test 1736582024”, “test 1734736950”,  “Business Alternate”, “Contact Alternate”, “test 1658442384”, “test 1576477246”, “test 518224939”, “Contact”]>>

The the parse statement is:

require "soap/wsdlDriver"

def test3
wsdl_url = "http://myhost/RequestManagement/RequestService.svc?wsdl"
driver = SOAP::WSDLDriverFactory.new(wsdl_url).create_rpc_driver

result_set = driver.FetchAllEmailRolesResult("")


p test3['FetchAllEmailRolesResult']['string']

Unfortunately, Google already discontinued their SOAP search API, it’s hard to run the google search example from RESTful Web Services? Can somebody send me an valid Google SOAP search api key?

Another issue with this SOAP::WSDLDriverFactory, how to control name space in request? Because we added the name space into our service contract.

[ServiceContract(Namespace = "Stakeholder")]
public interface IOrganizationServiceContract
OrganizationDto FetchOrganizationById(long id);

Ruby (method not found) Wcf Test Client (Test Passed)
ruby/lib/ruby/1.8/wsdl/operationBinding.rb:40:in `find_operation':
{http://tempuri.org/}FetchOrganizationById not found (RuntimeError)

&amp;amp;lt;a:Action s:mustUnderstand="1"&amp;amp;gt;Stakeholder/IOrganizationServiceContract/FetchOrganizationById&amp;amp;lt;/a:Action&amp;amp;gt;
&amp;amp;lt;FetchOrganizationById xmlns="Stakeholder"&amp;amp;gt;

RESTful service is the way to go, here is a simple demo I learned from how to setup WCF in RESTful service.


One thought on “PowerBuilder, Ruby consume WCF service

  1. Hi Franck,

    I am currently working for a french client who is about to setting up a huge CRM system. So their current PB application will have to exchage data with this CRM. I am looking forward to hire your expertise in order to help us to implement the use of WCF service.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s