Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
rajabhayya Sekharbhayya
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic