You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Ove Gram Nipen <ov...@delfidata.no> on 2006/05/02 10:18:36 UTC

Consuming web service using Integrated Windows Authentication without using proxy

Hi, 

I am trying to consume a web service which is hosted on an Internet Information Server (IIS) and which uses Integrated Windows Authentication. I'm using axis2 0.95. I've genereated a client stub with xmlbeans, like so: 

C:\temp\bksak3>wsdl2java -uri noark4ws.wsdl -o C:\temp\bksak3 -s -d xmlbeans -p no.riksarkivaren.www.noark4ws

The generation is successful. In my test code, I try to pass my credentials to the web server using ProxyProperties, as described in http://ws.apache.org/axis2/0_95/http-transport.html

  SOAPportStub stub = new SOAPportStub(null, "http://hostname/webservice.asmx");
  Options options = stub._getServiceClient().getOptions();
  HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties().new ProxyProperties();
//  proxyProperties.setProxyName(""); -- I don't have a proxy
//  proxyProperties.setProxyPort(0);
  proxyProperties.setDomain("mydomain");
  proxyProperties.setUserName("user");
  proxyProperties.setPassWord("secret"); 
  options.setProperty(HTTPConstants.PROXY, proxyProperties);
... (snip code to build the request document)

  stub.PutNoarksak(sakRequestDoc); // a method defined in the wsdl of the web service. 

When I run the test, it fails with the following exception:

06/05/02 09:38:14 org.apache.axis2.AxisFault: Connection reset; nested exception is: 
 java.net.SocketException: Connection reset; nested exception is: 
 org.apache.axis2.AxisFault: Connection reset; nested exception is: 
 java.net.SocketException: Connection reset
06/05/02 09:38:14  at org.apache.axis2.AxisFault.<init>(AxisFault.java:125)
06/05/02 09:38:14  at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:230)
06/05/02 09:38:14  at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:544)
06/05/02 09:38:14  at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:331)
06/05/02 09:38:14  at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:267)
06/05/02 09:38:14  at no.riksarkivaren.www.noark4ws.SOAPportStub.PutNoarksak(SOAPportStub.java:144)
... (snip call stack beneath the test call)

06/05/02 09:38:14  at java.lang.Thread.run(Thread.java:595)
06/05/02 09:38:14 Caused by: org.apache.axis2.AxisFault: Connection reset; nested exception is: 
 java.net.SocketException: Connection reset
06/05/02 09:38:14  at org.apache.axis2.AxisFault.<init>(AxisFault.java:125)
06/05/02 09:38:14  at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:310)
06/05/02 09:38:14  at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:205)
06/05/02 09:38:14  ... 37 more
06/05/02 09:38:14 Caused by: java.net.SocketException: Connection reset
06/05/02 09:38:14  at java.net.SocketInputStream.read(SocketInputStream.java:168)
06/05/02 09:38:14  at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
06/05/02 09:38:14  at java.io.BufferedInputStream.read(BufferedInputStream.java:235)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpParser.readRawLine(HttpParser.java:77)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpParser.readLine(HttpParser.java:105)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpConnection.readLine(HttpConnection.java:1115)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1832)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1590)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:995)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
06/05/02 09:38:14  at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
06/05/02 09:38:14  at org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:103)
06/05/02 09:38:14  at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:304)
06/05/02 09:38:14  ... 38 more


Am I doing this wrong? Is there another way to pass the credentials? I've read on http://people.etango.com/~markm/archives/2005/11/21/using_apache_axis_with_integrated_windows_security.html that you should simply pass the username and password directly to the stub using setUsername() and setPassword(), but these methods are not generated when using xmlbeans in axis2.
 
BTW, is commons-httpclient 3.0 the default http client in axis2, or do I need to configure this? 
 
Best regards, 
Ove Gram Nipen
Delfi Data
###########################################
This email message has been virus checked by the virus programs used
in Delfi Data AS
###########################################-------------------------------------------------------------------------------------------------------
This message is scanned by the antivirus systems at Delfi Data as