Invalid HTTP server response [401] while trying to communica
paramsevak Jul 9, 2008 8:52 AMI have ran into wall with this one.
I used wconsume to create a 2 web service clients. The clients are part of an application that is deployed on Jboss-4.2.2.GA. The first client works just fine. However the second client gets an "Invalid HTTP server response [401]" - Unauthorized" error. The second client tries to communicate with a web service that requires authentication. I have been using the folowing code to provide my credentials.
. . . InquiryPortType inqPort = InquiryWsIntf.getInquiryGWWSHTTPPort(); BindingProvider bp = (BindingProvider)inqPort; bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "userName"); bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "passWord"); return nqPort.someMethod(String); . . .
The following is stack trace.
Hello World. Exception in thread "main" javax.xml.ws.WebServiceException: java.io.IOException: Could not transmit message at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(ClientImpl.java:317) at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:255) at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164) at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150) at $Proxy16.doBatchAuthWS(Unknown Source) at com.cbc.services.salt.inquiry.InquiryInterface.transactInquiry(InquiryInterface.java:89) at com.cbc.services.salt.inquiry.InquiryInterface.main(InquiryInterface.java:28) Caused by: java.io.IOException: Could not transmit message at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnectionImpl.java:204) at org.jboss.ws.core.client.SOAPRemotingConnection.invoke(SOAPRemotingConnection.java:77) at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:337) at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243) ... 5 more Caused by: org.jboss.remoting.CannotConnectException: Can not connect http client invoker. at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:333) at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:135) at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122) at org.jboss.remoting.Client.invoke(Client.java:1634) at org.jboss.remoting.Client.invoke(Client.java:548) at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnectionImpl.java:183) ... 8 more Caused by: org.jboss.ws.WSException: Invalid HTTP server response [401] - Unauthorized at org.jboss.ws.core.soap.SOAPMessageUnMarshaller.read(SOAPMessageUnMarshaller.java:77) at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:473) at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:305) ... 13 more