Heads Up :
The post you are writing will appear in a public forum. Please ensure all content is appropriate for public consumption. Review the employee guidelines for the community here.
Created by: Fabien Damien on 13-10-2009 10:09:32 AM Hi All, I need help in developing an action element java class to be able to invoke an external web service. can anyone pinpoint a guide or a link? thanks in advance,
Subject: RE: Invoking a webservice using JAVA Replied by: Sherif Amer on 31-10-2009 09:35:56 AM Hi All, i have the same problem...any update regardin this issue ? appriciate any support.
Subject: RE: Invoking a webservice using JAVA Replied by: Fabien Damien on 01-11-2009 08:41:57 AM Hi Sherif, I managed to invoke the webservice by using a java class that sends the soap message expected by the webservice. here is an example: import com.audium.server.AudiumException; import com.audium.server.voiceElement.ActionElementBase; import com.audium.server.session.ActionElementData; import java.util.regex.*; import java.net.*; import java.io.*; public class Authentication3 extends ActionElementBase { public void doAction(String name, ActionElementData data) throws AudiumException { String type = "text/xml"; String SOAPTOTAL = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"http://192.168.6.160/webservice1\">" + "<soapenv:Header/>" +"<soapenv:Body>" +"<web:FabienRose>" +"<web:Message1>test</web:Message1>" +"</web:FabienRose>" +"</soapenv:Body>" +"</soapenv:Envelope>"; System.out.println(SOAPTOTAL); try { URL url = new URL("http://192.168.6.160/webservice1/service1.asmx"); HttpURLConnection conn = (HttpURLConnection)url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("content-Type",type); conn.setUseCaches(false); conn.setDoOutput(true); conn.setDoInput(true); DataOutputStream os = new DataOutputStream(conn.getOutputStream()); os.writeBytes (SOAPTOTAL); os.flush(); os.close(); BufferedReader reader = new BufferedReader( new InputStreamReader( conn.getInputStream() ) ); System.out.println("1"); String response = reader.readLine(); String result=response.substring( response.indexOf("<FabienRoseResult>") +"<FabienRoseResult>".length() , response.indexOf("</FabienRoseResult>")); ElementData("Authentication_Status"); data.setElementData("Authentication_Status",result); } catch (IOException e) { data.addToLog("Problem connecting to Web Service Socket", ""+e); } } private void ElementData(String string) { // TODO Auto-generated method stub } } Fabien
Subject: RE: Invoking a webservice using JAVA Replied by: Sherif Amer on 11-01-2010 02:00:41 PM Dear Fabien, Thanks very much for your support but I have another question and asked this question many times on the forums but no one answer me. I am using Call studio 7.0.2 and I am trying to use the web service element (my web service is deployed on oracle application server) the loading of the WSDL file is ok but once I tested the application and the element execute it I found a bad request error in the log¿ Any idea regarding this error and is am missing thing ? jars or what ever ?
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: