Java - Conectar con Web Service de Remed

 
Vista:

Conectar con Web Service de Remed

Publicado por Cristian (1 intervención) el 20/05/2010 22:52:01
Estimados,

Tengo un proyecto donde debo consumidor desde un Servidor Web de Remedy pero no encuentro un metodo de conexion ya que me pide que ingrese un usuario y password para poder ingresar al servicio y poder tomar los datos.

Lo que tengo es el siguiente codigo que me paso la gente de Remedy para poder realizar la conexion pero no veo ningun metodo de conexion donde pueda basarm, nada que me indique algo como esto:

// set up authentication info
AuthenticationInfo authInfo = new AuthenticationInfo();
authInfo.userName = "Demo"; // give a valid AR user name
authInfo.password = ""; // give a valid password

proxy.AuthenticationInfoValue = authInfo;

Pero si bien lo anterior lo realice un Servicio Web del propio Remedy pero en .Net.

El codigo siguiente es el de java.

Creating an Apache Axis Web Service Client
1. Install JDK 1.3.1 or above. Make sure java and javac are available in the PATH.
2. Install Apache Axis 1.0 from http://xml.apache.org/axis.
3. Install Xerces 2 Java Parser 2.2.0 from http://xml.apache.org/xerces2-j/index.html.
4. Install JavaServer Pages 1.2 classfiles from http://java.sun.com/products/jsp/download.html.
5. Set CLASSPATH to include Axis and Xerces jar files as follows:
set AXIS_DIR=<Axis Install Dir> (For example, S:\products\xml-axis-10)
set AXIS_LIB_DIR=%AXIS_DIR%\lib
set XERCES_DIR=<Xerces Install Dir> (For example, S:\xerces-2_2_0)
set JSP_DIR=<JSP Install Dir> (For example, S:\products\jsp-1_2)
set CLASSPATH=.;%AXIS_LIB_DIR%\axis.jar;%AXIS_LIB_DIR%\saaj.jar;%AXIS_LIB_DIR%\ log4j-1.2.4.jar;%AXIS_LIB_DIR%\wsdl4j.jar;%AXIS_LIB_DIR%\commons-discovery.jar;%AXIS_LIB_DIR%\jaxrpc.jar;%AXIS_LIB_DIR%\commons-logging.jar;%XERCES_DIR%\xercesImpl.jar;%XERCES_DIR%\xmlParserAPIs.jar; %JSP_DIR%\servlet.jar
6. Create a directory for building an Axis web service client (for example, C:\temp\axisclient).
7. Change directory to C:\temp\axisclient.
8. At the command prompt, type the following:
java org.apache.axis.wsdl.WSDL2Java -W -p ARWSClient http://<midtier_server>/arsys/WSDL/<arserver>/SimpleWebService
This generates proxy classes for writing the client program.
9. Create a directory for storing class files (for example, C:\temp\axisclient\classes).
10. Change directory to ARWSClient.
5
11. Create a new file called TestClient.java and add the following lines of code:
/**
* TestClient.java
*
*/
package ARWSClient;
import javax.xml.rpc.holders.StringHolder;
import javax.xml.rpc.holders.CalendarHolder;
public class TestClient {
public static void main(String args[]) throws Exception
{
SimpleWebServicePortType binding;
binding = new SimpleWebServiceServiceLocator().getSimpleWebServiceSoap();
// declare variables
CreateInputMap createInput = new CreateInputMap();
// supply values for creating an entry using OpCreate
createInput.setAssigned_To("Frank");
createInput.setShort_Description("Testing Axis Client");
createInput.setStatus(StatusType.New);
createInput.setSubmitter("Joe");
// make web service request to create an entry
CreateOutputMap createOuput = binding.opCreate(createInput);
System.out.println("Successfully created a request with id: " + createOuput.getRequest_ID());
// declare additional variables for get operation
GetInputMap getInput = new GetInputMap();
getInput.setRequest_ID(createOuput.getRequest_ID());
ARWSClient.GetOutputMap getOutput;
getOutput = binding.opGet(getInput);
System.out.println();
System.out.println("Following values have been returned by OpGet");
System.out.println();
System.out.println("Request_ID : " + getOutput.getRequest_ID());
System.out.println("Assigned_To : " + getOutput.getAssigned_To());
System.out.println("Create_Date : " + getOutput.getCreate_Date().getTime());
System.out.println("Last_Modified_By : " + getOutput.getLast_Modified_By());
System.out.println("Modified_Date : " + getOutput.getModified_Date().getTime());
System.out.println("Short_Description : " + getOutput.getShort_Description());
System.out.println("Status : " + getOutput.getStatus());
System.out.println("Status_History : " + getOutput.getStatus_History());
System.out.println("Submitter : " + getOutput.getSubmitter());
}
}

12. Type the following command:
javac -d ..\classes *.java
13. Open the mid tier configuration tool, and enter an Anonymous User Name under WebService Settings. (For example, Demo. The password of the user must be blank.)
14. Change directory to ..\classes.
15. Type the following command to run the client:
java ARWSClient.TestClient
16. The output should appear as follows:
Successfully created a request with id: 000000000000015
Following values have been returned by OpGet
Request_ID : 000000000000015
Assigned_To : Frank
Create_Date : Wed Jul 17 20:12:10 PDT 2002
Last_Modified_By : Demo
Modified_Date : Wed Jul 17 20:12:10 PDT 2002
Short_Description : Testing Axis Client
Status : New
Status_History : 2002-07-17T19:12:10-08:00 Demo
Submitter : Joe


Bueno si a alguien se le ocurre algun metodo o donde pueda guiarme por favor me avisas.

Muchas Gracias de antemano.

Cristian
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder