File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes WebService Client - Basic HTTP Auth Setup - RAD 7.5.5 [WAS 7.0] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "WebService Client - Basic HTTP Auth Setup - RAD 7.5.5 [WAS 7.0]" Watch "WebService Client - Basic HTTP Auth Setup - RAD 7.5.5 [WAS 7.0]" New topic
Author

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

Roshini Sridharan
Ranch Hand

Joined: Jan 16, 2001
Posts: 143
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
Meghana Reddy
Ranch Hand

Joined: Jan 29, 2002
Posts: 76
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
Meghana Reddy
Ranch Hand

Joined: Jan 29, 2002
Posts: 76
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);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WebService Client - Basic HTTP Auth Setup - RAD 7.5.5 [WAS 7.0]