Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

WebService Client - Basic HTTP Auth Setup - RAD 7.5.5 [WAS 7.0]

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have an issue with Web Service Client in RAD 7.5 and WAS 7.' I am new to Web Service. I would like to get advice on how to make the HTTP Authentication configuration for WEB SERVICE CLIENT CLASS.

Please find the details below

1. I have a Web Service [WSDL] that requires a HTTP Authentication to access it.
2. I generated a Dynamic Web Project and created the Web Service Client out of the WSDL through RAD 7.5
3. I have now JSP file through which i can invoke the Web Service
4. I have the HTTP Auth information configured in the WebService Binding Deployment Descriptor.[ibm-webservices-bnd.xmi]
<portQnameBindings.... .>
<basicAuth xmi:id="BasicAuth_1351130535775" userid="xxx" password="xxx"/>
</portQnameBindings>

The issue is when i run the TestWebClient.jsp on the Web Server, it displays the Web Service method and obtains the input, but when clicked on Invoke button the Response i get is

Exception: javax.xml.ws.WebServiceException: org.apache.axis2.AxisFault: HTTP ( 401 ) Authorization Required address : [URL]

I am not sure if there's any other place in the Java code i have to place the Authentication settings. The Web Service is based on JAX-WS.

Would appreciate if some one could shed some light on resolving this issue ASAP.

Thanks for the time.

Regards
Roshini Sridharan
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not familiar with RAD 7.5. So, I do not know which framework RAD is using to generate the web service client. If it is JAX-WS, you can set the basic auth in the MessageContext (this is typically done in a web service handler) as below:

Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("Username", Collections.singletonList("wsclient"));
headers.put("Password", Collections.singletonList("P@$$W0rd"));
MessageContext.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
 
Meghana Reddy
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not familiar with RAD 7.5. So, I do not know which framework RAD is using to generate the web service client. If it is JAX-WS, you can set the basic auth in the MessageContext (this is typically done in a web service handler) as below:

Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put("Username", Collections.singletonList("wsclient"));
headers.put("Password", Collections.singletonList("P@$$W0rd"));
MessageContext.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
 
Oh. Hi guys! Look at this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic