Arch2Arch Tab BEA.com
Syndicate this blog (XML)

Setting Basic Auth Headers with Axis for PAPI-WS

Bookmark Blog Post

del.icio.us del.icio.us
Digg Digg
DZone DZone
Furl Furl
Reddit Reddit

Clinton Davidson's Blog | August 2, 2006   3:14 PM | Comments (0)


First, generate the stubs using the Axis program WSDL2Java.

Next, open the generated file ProcessServiceServiceLocator and make the following changes:

1. Modify the constructor to take a username and password:

private java.lang.String username;
private java.lang.String password;

public ProcessServiceServiceLocator(java.lang.String username, java.lang.String password)
{
this.username = username;
this.password = password;
}

This allows you to pass in the basic auth username and password. These credentials can be found in the file /ptprocess/1.5/tomcat/conf/tomcat-users.xml.
Remove the default constructor.

2. Remove the existing getProcessService methods, and keep the one with the single argument URL portAddress. This way your generated stubs will work with any url, and not just the one that Axis hard-codes when generating the file. The url should be constructed from a string similar to this: http://<server_name>:8585/portal/webservices/ProcessService

Change the method getProcessService as follows:

public fuego.papi.ws.ProcessService getProcessService(java.net.URL portAddress) throws javax.xml.rpc.ServiceException 
{
  try 
  {
    fuego.papi.ws.ProcessServiceSoapBindingStub _stub = new fuego.papi.ws.ProcessServiceSoapBindingStub(portAddress, this);
    _stub.setPortName(getProcessServiceWSDDServiceName());
    _stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, username);
    _stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, password);
    return _stub;
  }
  catch (org.apache.axis.AxisFault e) 
  {
    return null;
  }
}

the only lines that are different are the _stub._setProperty lines.

Compile the classes, jar it up, and you can use this to access PAPI-WS without removing the basic authentication protection from the Process Server portal web-app. Alternatively, you can use this to set basic auth protection on the /webservices url pattern of ALBPM, and then access PAPI-WS with basic authentication.


Comments

Comments are listed in date ascending order (oldest first) | Post Comment



Only logged in users may post comments. Login Here.

Powered by
Movable Type 3.31