Invoking external web service
Hi,
What are the possible ways of invoking external web services from wso2 to create a mashup?
From the documentation found that WSRequest Object can be used and looked at the chad example in samples.
But still it is not clear how to achieve this.
Someone who have worked on this kindly help.
Thanks
Ramya
- Login or register to post comments
- Printer friendly version
- 648 reads











Have a look at these samples on mooshup
Hi Ramya,
I think you've mixed up things a bit. The chad sample is a sample thats available in WSAS. If you go through the WSRequest host object documentation at http://wso2.org/project/mashup/1.0/docs/index.html you will get a feel of how it can be used.
There are two different mechanisms you can access a wen service from a mashup. The first is using the WSRequest host object object and the second is using a genarated JavaScript stub. If its an external service you can use the stub gen tool available at https://localhost:7443/stub_gen.jsp to genarate a stub.
I have uploaded two mashups that show these usages independantly. U can try it out and have a look at its source. They are available at
https://mooshup.com/mashup.jsp?path=/mashups/keith/WSRequestHostObjectSample
https://mooshup.com/mashup.jsp?path=/mashups/keith/StubUsageSample
Hope that this info will help you.
Thanks,
Keith.
Accessing the web service stub
Hi Keith,
Thank you for the straightforward examples.
Now i am able to access external web services through WSRequest host object.
The second approach of using stubs to use a external web service is not working for me. It is working only for stubs that are available through the link as in example.
Calldigit.js
system.include("digit2image.stub.js");
function Digit2imageWS(){
try {
return digit2image.digit2image("5", "small");
} catch (e) {
throw e;
}
}
digit2image.stub.js is a E4X stub for the link http://mooshup.com/services/system/digit2image?wsdl and it is placed under Calldigit.resources.
It is giving the error as below,
org.apache.axis2.AxisFault: The system cannot infer the transport information from the digit2image URL. at org.wso2.javascript.rhino.JavaScriptEngine.call(JavaScriptEngine.java:184)
at org.wso2.javascript.rhino.JavaScriptEngine.call(JavaScriptEngine.java:210)
at org.wso2.javascript.rhino.JavaScriptReceiver.invokeBusinessLogic(JavaScriptReceiver.java:193)
...
...
Caused by: org.mozilla.javascript.JavaScriptException: org.apache.axis2.AxisFault: The system cannot infer the transport information from the digit2image URL. (ramya-Calldigit#11)
at org.mozilla.javascript.gen.c82._c1(ramya-Calldigit:11)
at org.mozilla.javascript.gen.c82.call(ramya-Calldigit)
..
...
</Exception>
</soapenv:Detail>
I am getting the same error for DOM stub and when tried with other web services also.
What should t do to solve this ?
Thank you
Ramya
using 1.0.2?
Are you perchance using v 1.0.1? We had a regression in that version with the stubs that might be causing it. The regression doesn't exist in 1.0 or 1.0.2.
The following works fine for me in 1.0.2:
system.include("/services/system/digit2image?stub&lang=e4x&localhost=true");
function Digit2imageWS(){
try {
return digit2image.digit2image("5", "small");
} catch (e) {
throw e;
}
}
Replacing the link above with a filename to a saved stub (generated from the same link - DOM stubs don't work in the Mashup Server since we don't need DOM) in the calldigit.resources folder should be identical (though more reliable on Mashup Server restarts than a dynamic stub.)