• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Calling webMethods from Java - 401 Unauthorized

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have requirement to call a webservice hosted by webMethods. I have tried using multiple ways of calling this service and each it fails stating my credentials are wrong.
I have tried following steps


1) Using SOAP, provided the WSDL, credentials, the SOAP UI put as log as below


Tue Feb 07 22:11:28 EST 2012:DEBUG:<< "HTTP/1.0 401 [ISS.0084.9001] Invalid credentials[\r][\n]"
Tue Feb 07 22:11:28 EST 2012:DEBUG:<< "HTTP/1.0 401 [ISS.0084.9001] Invalid credentials[\r][\n]"
Tue Feb 07 22:11:28 EST 2012:DEBUG:<< "WWW-Authenticate: Basic realm="webMethods"[\r][\n]"
Tue Feb 07 22:11:28 EST 2012:DEBUG:<< "Connection: Close[\r][\n]"
Tue Feb 07 22:11:28 EST 2012:DEBUG:<< "Content-Length: 0[\r][\n]"

2) Using SOA Client, I tried invoking it by providing the SOAP message and http header looking as below:

Authorization: Basic R0xEU1JWMVQ6NyNyc3BvaTQx2a
SOAPAction: {namespace}/{methodname}
Content-Type: text/xml
authtype=basic#realm=webMethods
WWW-Authenticate: Basic realm="webMethods"

It failed stating my credentials are incorrect.

3) Tried running a servlet with a regular http call



It failed with an exception as below

[2/7/12 22:50:36:801 EST] 00000021 SystemErr R java.io.IOException: Server returned HTTP response code: 401 for URL: webserviceurl
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1236)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.net.ssl.www2.protocol.https.b.getInputStream(b.java:49)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.TestServlet.postURL(TestServlet.java:146)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.TestServlet.doPost(TestServlet.java:117)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.TestServlet.doGet(TestServlet.java:54)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1449)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
[2/7/12 22:50:36:817 EST] 00000021 SystemErr R at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
[2/7/12 22:50:36:987 EST] 00000021 SystemErr R at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
[2/7/12 22:50:36:987 EST] 00000021 SystemErr R at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
[2/7/12 22:50:36:987 EST] 00000021 SystemErr R at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
[2/7/12 22:50:36:987 EST] 00000021 SystemErr R at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
[2/7/12 22:50:36:987 EST] 00000021 SystemErr R at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
[2/7/12 22:50:36:987 EST] 00000021 SystemErr R at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
[2/7/12 22:50:36:987 EST] 00000021 SystemErr R at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)


4) Tried using Apache HTTP client with java code looking as below



The above code failed with return error code as "401" which means unauthorized

5) Tried making a call by building Axis client stubs as below




It failed stating with below exception


AxisFault
faultCode: {http://xml.apache.org/axis/}HTTP
faultSubcode:
faultString: (401)[ISS.0084.9001] Invalid credentials
faultActor:
faultNode:
faultDetail:
{}:return code: 401

{http://xml.apache.org/axis/}HttpErrorCode:401

(401)[ISS.0084.9001] Invalid credentials
at org.apache.axis.transport.http.HTTPSender.readFromSocket(HTTPSender.java:744)
at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:144)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at com.TestServlet.doPost(TestServlet.java:109)
at com.TestServlet.doGet(TestServlet.java:54)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1449)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:790)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:443)
at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:175)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3610)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:274)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:926)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1557)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:173)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:455)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:384)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:272)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:202)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:766)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:896)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1527)


I am not sure if there is anything missing. Can you please help me troubleshooting this problem?
 
Greenhorn
Posts: 1
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Did you ever get this issue resolved?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic