Hi,
How to invoke services in webMethods through J2EE. How would be the flow between J2EE and webMethods?
Regards,
Partha
Hi,
How to invoke services in webMethods through J2EE. How would be the flow between J2EE and webMethods?
Regards,
Partha
Hi Partha,
I’m studying this these days and I have invoked the webMethods flow service successfully.
Just use forward:
click here
You will find a input string parameter A & AList in pipeline
This method you can refer to the html code of submit EDI in IntegrationServer.
Use java code to connect webMethods:
URL mURL = new URL(“http://hostname:port/invoke/folder/servicename”);
HttpURLConnection conn=(HttpURLConnection)mURL.openConnection();
conn.setRequestMethod(“POST”);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setRequestProperty(“Cache-Control”, “no-cache”);
conn.setRequestProperty(“Accept”,“text/xml”);
conn.setRequestProperty(“Content-Encoding”,“UTF-8”);
conn.setRequestProperty(“Content-Type”,“text/xml”);
conn.connect();
OutputStreamWriter out = new
OutputStreamWriter(conn.getOutputStream(),“UTF-8”);
if (! contratStream){
out.write(contrat,0,contrat.length());
out.write(“\r\n”,0,2);
}else
{
try {
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(new File(“C://TEST.txt”)),“UTF-8”)) ;
int c ;
String str;
while ((str = in.readLine()) != null)
{
out.write(str,0,str.length());
out.write(“\r\n”,0,2);
}
in.close();
}catch (IOException e){
e.printStackTrace();
}
}
out.flush();
out.close();
System.out.print("reponse from WMServer : ");
System.out.println(conn.getResponseMessage());
conn.disconnect();
There is a variable named ‘node’ in pipeline. Be careful the Content-Type you use.
text/xml → node
text/plain → stream
You should invoke XMLNodeToDocument or streamToBytes first, then save the pipeline, you will find the data you send to this service.
If you want to know more, you can view this web site : www.wmusers.com.
Hi,
I am also looking similar kind of senario, where i want to call html/jsp page which is running in different server say weblogic/tomcat... from webmethods flow service.
in detail:-
I am using html page to call the webMethods service for inserting the data in database. For this i have given flow serivce url in html and its working fine. Now i want to send the success message to html page (same/different html page eg. success.html) for this i am using http web method service. I have provided my sucess page url along with credentials to the pub.client:http service pipeline. when i am running the serivce, its able to call the http url sucessfully but page is not redirecting to sucess.html page. Its staying at webMethods page i.e., flowservice page.
Could any one please help me here.
Regards,
Sreenivas.
HTML works, but imho is not a good architectural choice (calling from JEE).
Why don’t you just use Soap or Rest? IS Services can be easily exposed as SOAP or REST services and this way you have a standard protocol which fits much more for service calls than html.
If you want to have a tighter coupling, you can use the Java libarries shipped with IS and call IS services via those. The code for calling a service can even be generated using Designer.
Hi,
Thanks for your inputs.
I am using REST service to get the information from database.
I have few queries on REST service.
The REST URL is something different with normal urls in terms passing parameters.
eg:- In normal JSP urls, if i want to pass two paramenters say userid and password it will go as …/servicename?userid=srinu&password=vas
But REST url is something like …/servicename/srinu/vas.
For this client need to make the URL as per REST Standards or is there any way to pass the parameteres like JSP.
In my example my select query takes more than two parameters. In this case how can we pass 3rd parameter.
eg: empid,name,deptname (all these three fields are in one table.)
i have mapped resourceid->empid and name,deptname->path. but its not workring.
Also can you please explain the usage of $path attribute.
Regards,
Sreenivas.
Could any one please help here?
Regards,
Sreenivas
Hi Srinivas,
To see the result in success.html , you have to set the “Template” filed in service properties field.
Template=success.html and put this html file inside template folder of your package.
Thanks
Bappi
I need a help to write a service which alerts if Integration server is down.
For example we have 30 servers to monitor daily instead of that I need to get alert email daily which is in down.
Thanks in advance
You can ping the IS port (http_ itself and check the http response returned on time or not responded before you send an alert to the support teams.
ping example:
http://ishost:5555/invoke/wm.server/ping
HTH,
RMG
Calling Integration Server services with Java is easy. Because Designer actually generates the code for you!
In Designer, right click a service and select “Generate Code…”. Then select the option “For calling this service from a client”. On the next popup, pick a programming language, and then tell the generator where to put the client code.
And the best thing? This approach is using public IS APIs and thus is supported by Software AG Global Support.
Hope this helps, Chris
Go with suggested approaches or even you can go with making use of standard ART services to ping target server programmatially.
Thanks,