OrangeScape Developer Community

A community for Application Developers on OrangeScape's Platform-as-a-Service

Consuming Webservices with OrangeScape

It's not always that you will build everything that you need into a single application, or that you application can function stand alone.  Your application may be required to get some sort of data or information from another system in your network / application of another department.  OrangeScape uses web services as a way to integrate with other systems.  Currently only SOAP based web services are supported.

WebService is a command available in Action Design Perspective.
Let's see how to configure and use a webservice.  For this purpose i am going to use a webservice which will provide information about country like currency used, capital city etc.  You can find the WebService WSDL here. The WebService provider will give you a WSDL file, which will provide the information as to how to invoke a particular functionality provided by them.
Create a model with two fields Country and Country_Code.  Goto Action Design and add a new action.  Add the WebService command in that action.  In the WebService Properties.
There are six general configuration parameters and then there are input and output parameters which you will have to configure for web service to work.

URL The URL for the WSDL of the webservice which you are going to use
NameSpace The NameSpace to use.  You can find this value in the WSDL as an value of attribute  named target namespace
Action The url / name of the action which you want to call
Root The Root Node of the input parameters as defined in the WSDL
ResponseHeader The Root Node of the output parameters as defined in the WSDL

Using this Country Information Services i am going to first get the Country ISO code. As you can see in the screenshot i have entered the required information for the parameters.  Now after deploying this application and if i execute this action, The Country's (the country mentioned in the input box named Country) ISO Code will be updated into the Country_Code field and saved.

Update:

It seems the webservice response has changed recently.  You can see the appengine logs to see the response xml which the webservice returns.  

Please use CountryISOCodeResult instead of CountryISOCode in the Output parameters.

Views: 989

Comment

You need to be a member of OrangeScape Developer Community to add comments!

Join OrangeScape Developer Community

Comment by Kamal.S on March 27, 2014 at 3:50pm
Comment by VM.Hanitha on October 15, 2012 at 1:13pm

I was not knowing the url and responseheader since full url and response header was not displayed in the image above. Since I gave proper url and response header it worked . The url is http://webservices.oorsprong.org/websamples.countryinfo/CountryInfo...  and responseHeader is CountryISOCodeResponse  and not CountryISOCodeResponseHeader and it worked..

Comment by VM.Hanitha on October 12, 2012 at 1:23pm
I am getting following error when I tried to do the same example in my application. Will someone help me resolve this.

IndexError:list index out of range Traceback (most recent call last):</br>
File "/base/data/home/apps/s~webappn/1.362395419415502310/orangescape/model/engine/execution/actions/WebServiceCommand.py",
line 187, in __process_response__</br> responseHeader=childNodes.getElementsByTagNameNS(self.namespace,self.responseHeader)[0]</br>
IndexError: list index out of range</br>
Comment by Lydia C. on October 19, 2011 at 6:28pm

Hi Anbarasan ,

I'm trying to call REST webservices without successs. I didn't found any documentation that could help.

Could you please show an example on how to call and consume  REST webservices with OrangeScape??

Thanks in advance,

Lydia.

Comment by Michael A on January 5, 2011 at 8:55pm

I made a little more progress which brought up a few new questions:

 

To fix the issue, I found that I had to remove an action that updated a field. I originally had the webservice output parameter placed into variable x, then i did an update action to put the value of x into variable y. Why was this preventing me from getting the output parameter?

 

Now that I removed the action, I get an output parameter from the webservice. But I need to refresh the page to see the result. Why is this? Is there any action I can take to refresh the field immediately after the webservice finishes??

 

Thanks,

-Mike

Comment by Michael A on January 5, 2011 at 7:59pm

Here is my appengine log as you requested:

 

#65.204.211.10 - michael.a [05/Jan/2011:06:19:18 -0800] "POST /Application_b37f96e1_1293_11e0_8de8_fde633d6d41e/1/Shb49c40ce889848608136fd7023ce688d/Ac5b66f58bcfe04021933c56859c46be86/Shb49c40ce889848608136fd7023ce688d/Leave_137b530a_18d6_11e0_8893_b555b435f183?action=invoke&invoke=CallWS~Gra7c41f3827164619901c374453d54ef4&actionType=Action&editorGridViewId=Gra9ba3c9eeb37452caf7607dd18d72620 HTTP/1.1" 200 421 "http://orangescapetest.iomapps.invensys.com/Application_b37f96e1_1293_11e0_8de8_fde633d6d41e/1/Shb49c40ce889848608136fd7023ce688d/Ac5b66f58bcfe04021933c56859c46be86/Shb49c40ce889848608136fd7023ce688d/Leave_137b530a_18d6_11e0_8893_b555b435f183?mimetype=text/html" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; CWADS32; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MS-RTC LM 8),gzip(gfe),gzip(gfe),gzip(gfe)" "orangescapetest.iomapps.invensys.com" ms=178 cpu_ms=307 api_cpu_ms=73 cpm_usd=0.008920
#I 01-05 06:19AM 18.142
Executing WebService (Ac74f0e3736dcf45a5baaf8b2f0fb4b375) for the sheet Leave_137b530a_18d6_11e0_8893_b555b435f183
#I 01-05 06:19AM 18.156
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="http://invensys.com/wsCases">
#E 01-05 06:19AM 18.257
   <soap:Header/>
#E 01-05 06:19AM 18.257
   <soap:Body>
#E 01-05 06:19AM 18.257
        <urn:HelloWorld>
#E 01-05 06:19AM 18.257
        </urn:HelloWorld>
#E 01-05 06:19AM 18.258
   </soap:Body>
#E 01-05 06:19AM 18.258
</soap:Envelope>
#E 01-05 06:19AM 18.258
#I 01-05 06:19AM 18.221
the response xml is <?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><HelloWorldResponse xmlns="http://invensys.com/wsCases"><HelloWorldResult>Hello World</HelloWorldResult></HelloWorldResponse></soap:Body></soap:Envelope>
#E 01-05 06:19AM 18.222
IndexError:list index out of range Traceback (most recent call last):</br>  File "/base/data/home/apps/invensys.com:orangescapetest/1.347400930998881605/orangescape/model/engine/execution/actions/WebServiceCommand.py", line 124, in __process_response__</br>    paramNode=responseHeader.getElementsByTagNameNS(self.namespace,outputPort.getParamName())[0]</br>IndexError: list index out of range</br>
#I 01-05 06:19AM 18.222
Executing OR (Aced388e1e99a243598d0d3379d858b656) for the sheet Leave_137b530a_18d6_11e0_8893_b555b435f183
#I 01-05 06:19AM 18.223
Executing Update (Acce9e675c77c8418a83b434f8197fb083) for the sheet Leave_137b530a_18d6_11e0_8893_b555b435f183
#D 01-05 06:19AM 18.223
Updating values {'Applied_By': 'Blank'} for the model Leave(Leave_137b530a_18d6_11e0_8893_b555b435f183) for Update (Acce9e675c77c8418a83b434f8197fb083)
#I 01-05 06:19AM 18.223
Need to go to the next process of OR activity Aced388e1e99a243598d0d3379d858b656(Aced388e1e99a243598d0d3379d858b656) in
#I 01-05 06:19AM 18.255
Saved; key: __appstats__:058000, part: 440 bytes, full: 60633 bytes, overhead: 0.001 + 0.004; link: http://orangescapetest.iomapps.invensys.com/stats/details?time=1294...


Comment by Michael A on January 5, 2011 at 7:15pm

Hi, I am having trouble getting the Output Parameters out of my webservice. I have watched the traffic on my webserver and my webservice is definitely being called by my OrangeScape application and returning the correct value.

I do not know how to tell if my application is receiving the output parameter. I set it up as shown above. I put the result into a field from the Model view. I have the field displayed in a text box in the Form view. When I click my button that has the webservice action, I see "Processing" in the corner, but the field does not update.

Any ideas on what I may be doing wrong? My coworker is having the same problem using the webservice used in the blog, so we think our problem must be with the way we are using the output parameter?

Thanks,

-Mike

© 2017   Created by OrangeScape Technologies.   Powered by

Badges  |  Report an Issue  |  Terms of Service