sample Currency Web-Service invoke

rstanciu

Member
Code:
/* client_Currency.p */
DEFINE VARIABLE hWebService AS HANDLE NO-UNDO.
DEFINE VARIABLE hCurrencyServerWebServiceSoap AS HANDLE NO-UNDO.
CREATE SERVER hWebService.
hWebService:CONNECT("-WSDL 'http://www.currencyserver.de/webservice/currencyserverwebservice.asmx?WSDL'").
RUN CurrencyServerWebServiceSoap SET hCurrencyServerWebServiceSoap ON hWebService.
DEFINE VARIABLE provider    AS CHARACTER NO-UNDO.
DEFINE VARIABLE srcCurrency AS CHARACTER NO-UNDO.
DEFINE VARIABLE dstCurrency AS CHARACTER NO-UNDO.
DEFINE VARIABLE getCurrencyValueResult AS CHARACTER NO-UNDO.
provider    = "AVERAGE".
srcCurrency = "EUR".
dstCurrency = "USD".
RUN getCurrencyValue IN hCurrencyServerWebServiceSoap(INPUT provider, INPUT srcCurrency, INPUT dstCurrency, OUTPUT getCurrencyValueResult).
hWebService:DISCONNECT().
MESSAGE srcCurrency "->" dstCurrency "="
getCurrencyValueResult VIEW-AS ALERT-BOX.
 

RealHeavyDude

Well-Known Member
Most likely it won't work because different web service may use different WSDL documents.

In order to consume a web service you need to have access to the WSDL document. Usually you can download it directly from the web site that is hosting the web service but there also some out there that require you to register and then send you the WSDL via email or other channels.

As soon as you have access to the WSDL document you can run the WSDL analyzer against it and it will generate example code how to access the operations in the service.

The WSDL analyzer is a command line tool that you start in the proenv environment. Just type bprowsdldoc.


HTH, RealHeavyDude.
 
Hi rstanciu, this currency.p is getting the latest currency rate from www.currencyserver.de?
How if i want to change the currency website to others site?
Thanks.

Download soapUI. It is test tool for web services.
It reads wsdl definition and creates template to query webservice.
You can try to query it w/o any line of code.

If webservices begins to work in test enviroment then change code to satisfy wsdl requirements.
currencyserverde.jpg


Notice in test example:
CurrencyServerWebServiceSoap = wsdl port
getCurrencyValue - procedure name inside port.
NPUT provider, INPUT srcCurrency, INPUT dstCurrency - is input parameters in soap body
OUTPUT getCurrencyValueResult - is output parameter in soap result body.
 

redsuitee

Member
I've tried that WSDL URL with SOAP UI and it worked.

But when I type bprowsdldoc + that URL with proenv, they returned error message
Error loading WSDL Document : <WSDL URL> Error : Can't locate remote host
Reason : gethostbyname operation failed <WinSock reported error=11004>location:<WSDL URL> (11748)
 

redsuitee

Member
I've tried ping that URL and I got this message :
"Ping reuest could not find host <WSDL URL>"

But the URL works in SOAP UI. Why can it happen?
 

RealHeavyDude

Well-Known Member
You should provide the exact command which you type in proenv with bprowsdldoc and ping an the exact error messages as you get there.

RealHeavyDude.
 

redsuitee

Member
I write this :
Code:
proenv>bprowsdldoc https://staging.siteminder.com.au/pmsxchange/services/pmsxchange.wsdl
Error message : 9318
Error message : 9407
Error loading WSDL Document : <WSDL URL> Fatal error: connect operation failed <WinSock reported error=0> location:<WSDL URL> (11748)

When I try ping that URL, I got this .
Code:
proenv>ping https://staging.siteminder.com.au/pmsxchange/services/pmsxchange.wsdl
Ping reuest could not find host <WSDL URL>. Please check the name and try again.
 
Ping uses tcp-ip transport
explorer/web service connection - http transport, which reads your proxy settings. So it is possible that explorer works and ping doesnt.
 

CyrixInstead

New Member
Did you ever manage to solve this redsuitee? I am having exactly the same problem myself (OpenEdge 10.2B04, Windows 7). It seems that you are trying to access a secure web service through HTTPS, but for me I am trying to access a web service through standard http. The web service is actually an OpenEdge one hosted on our client's site, and I'm trying to connect to it from my AppBuilder in my work environment. This issue also cropped up in another Progresstalk thread, but unfortunately nobody was able to help.

Errors 9407 and then 11748 are a known Progress issue and seems to be caused by a 'network configuration issue’; I suspect in my case that the problem is due to being behind a corporate firewall. We use Microsoft's Forefront Threat Management Gateway (TMG) and it does all sorts of 'clever' things, one of which seems to prevent the OpenEdge CONNECT statement managing to get outside of the corporate firewall.

In order to establish that it is my network, I will be shortly attempting to access the web service through a bog standard Internet connection with no clever firewall, just the software firewall on a company laptop. I'll keep people posted on the result as an FYI.

~Cyrix
 
Top