File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes How to apply security paramters in a main program to interact with webservice with weblogic10.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "How to apply security paramters in a main program to interact with webservice with weblogic10.3" Watch "How to apply security paramters in a main program to interact with webservice with weblogic10.3" New topic
Author

How to apply security paramters in a main program to interact with webservice with weblogic10.3

rajabhayya Sekharbhayya
Greenhorn

Joined: Oct 23, 2008
Posts: 14
hi,

I have written a build.xml using clientGen task taking input as WSDL , to consume subscribepresence webservice , when i run the build.xml, I got all the presence webservice related stubs ,Implmentation classes and interfaces .
Now i have written a main program, and by utilizing generated stubs and implmentation classes, i am trying to call a webservice

==========================
Below is my main program

import java.net.URI;

import org.csapi.schema.parlayx.common.v2_1.PolicyException;
import org.csapi.schema.parlayx.common.v2_1.SimpleReference;
import org.csapi.schema.parlayx.presence.consumer.v2_3.local.SubscribePresence;
import org.csapi.schema.parlayx.presence.consumer.v2_3.local.SubscribePresenceResponse;
import com.bea.wlcp.wlng.ws.presence.PresenceConsumer;
import com.bea.wlcp.wlng.ws.presence.PresenceConsumerService_Impl;

import java.net.URI;

import org.csapi.schema.parlayx.common.v2_1.PolicyException;
import org.csapi.schema.parlayx.common.v2_1.SimpleReference;
import org.csapi.schema.parlayx.presence.consumer.v2_3.local.SubscribePresence;
import org.csapi.schema.parlayx.presence.consumer.v2_3.local.SubscribePresenceResponse;
import com.bea.wlcp.wlng.ws.presence.PresenceConsumer;
import com.bea.wlcp.wlng.ws.presence.PresenceConsumerService_Impl;

public class Main {

/**
* @param args
*/
public static void main(String[] args) throws javax.xml.rpc.ServiceException,PolicyException{

try{
PresenceConsumerService_Impl pcs_impl = new PresenceConsumerService_Impl("http://localhost:8002/parlayx21/presence/PresenceConsumer?WSDL");
PresenceConsumer pc = (PresenceConsumer) pcs_impl.getPresenceConsumer();
SimpleReference rf = new SimpleReference();
rf.setCorrelator("correlatorid");
rf.setEndpoint(URI.create("http://localhost:8002/PresenceConsumerService/services/PresenceConsumer"));
rf.setInterfaceName("PresenceConsumer");
SubscribePresence sb = new SubscribePresence();
sb.setApplication("sdp");
sb.setPresentity(URI.create("tel:1234"));
sb.setReference(rf);
System.out.println(" Before calling subscribe presence ");
SubscribePresenceResponse spr = pc.subscribePresence(sb);

System.out.println(" Hi There here 2226678565");
System.out.println(" Hi There here 333");
}
catch(PolicyException e)
{
System.out.println(" Hi There here 444 ");
}
catch(Exception e)
{
e.getCause();
System.out.println(" Exception Cause =="+e.getCause());
}

}

}

============

When i run above main program, I am getting below exception


Before calling subscribe presence
Exception Cause ==weblogic.wsee.jaxrpc.soapfault.WLSOAPFaultException: Unable to add security token for identity


Please tell me where I am going wrong, where to add security parameters, I checked in stubs and classes for security related parameters, but i could not find them
From google, I found that there is presenceconsumerclient class from oracle.sdp.paralyx....PresenceConsumerClient class, where we has username and password varaibles which can be set , but i am using pte.jar which does not contain that package.
Please let me know what more classes or jars required to add security parameters
Is there any way of adding security credentials to interact with webservice .
 
Don't get me started about those stupid light bulbs.
 
subject: How to apply security paramters in a main program to interact with webservice with weblogic10.3