This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Client Authentication for a web services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Client Authentication for a web services" Watch "Client Authentication for a web services" New topic
Author

Client Authentication for a web services

JyotiRanjan Swain
Greenhorn

Joined: Sep 26, 2006
Posts: 1
HI,
I trying to call a web servcices fom my client class. The Webservice when accessed from browser ,asks for user and password. How to pass the user and password to the webservice,when invoking it

I am using the client jar build in weblogic platform.


While calling the Web services i am getting following error.

java.io.IOException: Server returned HTTP response code: 401 for URL: http://wsgw-uat.mot.com:8080/iTunes_SN_Validation-Test?wsdl
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at weblogic.webservice.tools.wsdlp.DefinitionFactory.createDefinition(DefinitionFactory.java:113)
at weblogic.webservice.tools.wsdlp.WSDLParser.<init>(WSDLParser.java:76)
at weblogic.webservice.WebServiceFactory.createFromWSDL(WebServiceFactory.java:108)
at weblogic.webservice.core.rpc.ServiceImpl.<init>(ServiceImpl.java:91)
at com.mot.pcs.upd.tac.services.SerialNoValidates_Impl.<init>(SerialNoValidates_Impl.java:22)
at com.mot.upd.uid.services.UIdValidateServices.uidvalidate(UIdValidateServices.java:125)
at com.mot.upd.uid.services.UIdValidateServices.main(UIdValidateServices.java:340)

******************************************
Code is as follows
public WS_UID_Validation_Result uidvalidate(ServiceInputs input_object) throws Exception
{
System.setProperty("javax.xml.soap.MessageFactory",
"weblogic.webservice.core.soap.MessageFactoryImpl");
// Setup the global JAX-RPC service factory
System.setProperty( "javax.xml.rpc.ServiceFactory",
"weblogic.webservice.core.rpc.ServiceFactoryImpl");

String remoteURL="http://wsgw-uat.mot.com:8080/iTunes_SN_Validation-Test?wsdl";


System.setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY,"testuser");
System.setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY,"123pass");
System.setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY,remoteURL);
System.out.println("1");
Ws_SerialValidation_Result outObject = new Ws_SerialValidation_Result();
System.out.println("2");
ServiceInput inpObject = new ServiceInput();
System.out.println("3");

//I call the webservice here I GET ERROR HERE ONLY
SerialNoValidates_Impl ws = new SerialNoValidates_Impl(remoteURL);
//get the port
SerialNoValidatesPort port = ws.getserialNoValidatesPort();
//invoke the method
outObject = port.service(inpObject);


}catch(Exception e)
{
e.printStackTrace();
}
finally
{
if(conn!=null)
conn.disconnect();
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client Authentication for a web services
 
Similar Threads
How to create Web service using JAX-WS in Jboss
Web service handler could not registered/called in client web service
SOAPFaultException: Endpoint {http://test.com/}TestPort: does not contain operation meta data
java.rmi.RemoteException: does not contain operation meta data
SOAPException: Error opening socket