• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
 
And then the flying monkeys attacked. My only defense was this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic