Home
TeamSite
How to Invoke a Web Service
Rey
Does anyone know how to invoke a web service from a workflow step? I want to invoke a web service from a workflow step and then have the web service give back a parameter that the workflow understands that the web service completed it's task and it is ok to continue to the next step in the workflow.
Not too sure how to do this, any help would be greatly appreciated. Working on TS 6.1, Windows 2000 servers.
Thanks,
Rey
Find more posts tagged with
Comments
Migrateduser
Your question is pretty vague, so I'm going to make some assumptions and give you a quick answer:
1 - Add an external task to your workflow
2 - In the perl for the external task, use the SOAP::Lite module
3 - Either buy the book Programming Web Services with Perl, or look for an online documentary on the SOAP::Lite module.
If the web service is a .Net web service, be sure to read this tech note from MS:
http://support.microsoft.com/default.aspx?scid=kb;en-us;308438
Rey
Sorry for the vagueness, but just trying to see if it is possible first. I am actually trying to use a web service to perform like an ETL (Extract Transform Load) tool for our project. The web service will get invoked as part of the workflow/opendeploy process and the web service (.NET web service) will actually do all the work of parsing the DCR/XML file and performing actions to update/insert/delete/retrieve information from a SQL database. Then the web service will return an indicator back to the external task that it is complete and can continue to the next step in the workflow.
Rey
Migrateduser
Yes, what you want to do is doable. I think that MS tech note should get you a fair bit of the way toward what you want to do.
Rey
I just discovered today that Microsoft will no longer be using the SOAP Toolkit, and that is one of the requirements for using SOAP::Lite. Unfortunately, my company will not install the toolkit since it is being outed by Microsoft.
So does anyone else have any other ideas in terms of calling a web service from a workflow task (external task)? I know I could use a HTTP get and pass the XML web service all the parameters, but I thought SOAP was the way to go instead. Any help would be greatly appreciated.
Rey
Migrateduser
You don't need the Microsoft SOAP toolkit. It was for writing web services clients prior to the creation of the .Net framework. All .Net web services clients speak SOAP natively, and SOAP::Lite is all you will need client side for your perl script.
Rey
Just so I am clear, all I would need to do is install the SOAP::Lite on the TeamSite server and of course have the .NET framework installed on the TS server? There is no dependency between SOAP::Lite and the Microsoft SOAP Toolkit? If you happen to know of any online documentation that describes this, I would greatly appreciate it as I am trying to convince our architects to allow the usage of SOAP::Lite.
Rey
Migrateduser
You only need SOAP::Lite on the TeamSite server. You do not even need the .Net framework, unless you are also planning on building web services clients in C# or VB.Net. If you look at the README in the tarball for SOAP::Lite, it should list the pre-reqs. The SOAP toolkit will be completely absent. In terms of convincing your architects, though, I would just hand them that whitepaper from Microsoft and say "this is how MS says to do it."
In 6.5 (and I believe 6.1) SOAP::Lite is installed by default as one of the vendor libs (check iw-home/iw-perl/vendor/lib), so you don't even need to do anything other than diplomatically convince these surely very qualified and reasonable individuals that they are making a mountain out of a mole hill that doesn't even exist.
Rey
You are correct the libraries are already installed on the TS Server (we are using TS 6.1). But I am still somewhat confused on how to write the PERL script that will call the .NET web service? Here is my quick example:
use SOAP::Lite;
print SOAP::Lite
-> uri('
http://localhost/WebService1/Service1.asmx')
-> proxy('
http://localhost/WebService1/Service1.asmx')
-> ConvertTemperature(0)
-> result;
print "test for soap call using SOAP::Lite";
I got this sample code from cpan (
http://search.cpan.org/~byrne/SOAP-Lite-0.60a/lib/SOAP/Lite.pm#SOAP::Lite
) and modified it for my use. The data in the uri & proxy is the name of the webservice that I created, which is a real simple one. The web service takes a parameter and converts it. The name of the web service method I am trying to call is ConvertTemperature. When I run this script on the command line, only the last print line gets outputted to the screen, I would have thought the result would have gotten printed out too?
Any suggestions? Sorry, but this is my first crack at using web services with TeamSite.
Thanks,
Rey
Johnny
This
post
has a SOAP::Lite example (using TeamSite's content services API).
Apart from that - I doubt you will be able to find much help in this forum - especially to do with .NET as I think your issues are more around creating the web service and not TeamSite related.
John Cuiuli
Migrateduser
If you look at the Microsoft doc I linked above, it gives very specific examples.
In your code, I suspect that you are getting back an empty result, for reasons that are explained in that document. If you download tcptrace.exe (I think the url for it is included in that doc) so you can catch the envelopes of the request and response, I think that will also help you figure out what's going on. It would also be a good idea to set an on_fault() handler (as described in the SOAP::Lite perldoc). That would also show you the error you are getting.
I have some working code I can send you, but it's on a machine that I won't near again until Wednesday. If you haven't figured it out before then, remind me and I'll send it to you.
Migrateduser
BTW, John, thanks for the link to that thread. I've been trying to get some joy from content services using SOAP for a week or so and haven't had any luck. I even have a case open with support which is being ignored even as we speak.
I think the stuff in that thread may get me over the humps caused by the somewhat less than thorough documentation.
Johnny
Yep Navneet covered it well. The details in his explaination really helped.
John Cuiuli
m_rajani
Hi John
Can you post the link again, seems the link that you posted may be dated.
Mahesh