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” />
My PowerBuilder client can consume this WCF/Soap webservice now:
- Add pbwsclientXXX.pbd to lib list.
- 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.
- 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] )
Next
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:0×423a8b2 {http://tempuri.org/}FetchAllEmailRolesResult=#<SOAP::Mapping::Object:0×423a7ae {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("")
result_set
end
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
{
[OperationContract]
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;lt;s:Header&amp;gt;
&amp;lt;a:Action s:mustUnderstand="1"&amp;gt;Stakeholder/IOrganizationServiceContract/FetchOrganizationById&amp;lt;/a:Action&amp;gt;
&amp;lt;a:MessageID&amp;gt;urn:uuid:60e56fd8-7d46-44db-8b79-61c5e4784a85&amp;lt;/a:MessageID&amp;gt;
&amp;lt;a:ReplyTo&amp;gt;
&amp;lt;a:Address&amp;gt;http://www.w3.org/2005/08/addressing/anonymous&amp;lt;/a:Address&amp;gt;
&amp;lt;/a:ReplyTo&amp;gt;
&amp;lt;/s:Header&amp;gt;
&amp;lt;s:Body&amp;gt;
&amp;lt;FetchOrganizationById xmlns="Stakeholder"&amp;gt;
&amp;lt;id&amp;gt;8172&amp;lt;/id&amp;gt;
&amp;lt;/FetchOrganizationById&amp;gt;
&amp;lt;/s:Body&amp;gt;
&amp;lt;/s:Envelope&amp;gt;
|
RESTful service is the way to go, here is a simple demo I learned from how to setup WCF in RESTful service.