• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Client Authentication for a web services

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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();
}
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic