JAX-WS Client work over HTTPS but not over HTTP - Websphere

This is a discussion on JAX-WS Client work over HTTPS but not over HTTP - Websphere ; Hi, I have a problem with a very simple web service example using JAX-WS. Basically, the problem is that if I put in the binding part of the WSDL an soap:address location with HTTP the static client does not work ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: JAX-WS Client work over HTTPS but not over HTTP

  1. JAX-WS Client work over HTTPS but not over HTTP

    Hi, I have a problem with a very simple web service example using JAX-WS.

    Basically, the problem is that if I put in the binding part of the WSDL an soap:address location with HTTP the static client does not work and throws

    javax.xml.ws.WebServiceException: org.apache.axis2.AxisFault: HTTP ( 400 ) Bad Request address : http: //localhost:9081/bank/BankingService


    But if I only change it for HTTPS it works . (For full explanation read below)



    Is there any config on WAS that I must change for a Client works over HTTP?... I have the default configuration of the trial WAS.



    The situation is:




    I run a Web Service Server generated WS from a JavaBean
    I generate a JAX-WS Client
    I generate a Servlet using the WS Client that I generated before
    I test the WS using the Web Service Explorer and it work ok
    But when I test the client using the Servlet it does not work
    After some search, tests, read the redbooks, and many headaches I have discovered one point:

    If in WSDL of the WS Server I have in the binding part pointing to a HTTPS URL it works...

    soap:address location= "https://localhost:9444/bank/BankingService"


    But if I change that line for:

    soap:address location= "http://localhost:9081/bank/BankingService"



    This simple change implies that the use of the client on the servlet work or not. This is how I use the client:

    BankingService service = new BankingService();
    BankingSEI port = service.getAccountsPort();
    long result = port.createAccount( "Bob" , 1000.5);




    The full exception that I get is:

    javax.xml.ws.WebServiceException: org.apache.axis2.AxisFault: HTTP ( 400 ) Bad Request address : http: //localhost:9081/bank/BankingService
    at org.apache.axis2.jaxws.ExceptionFactory.createWebS erviceException(ExceptionFactory.java:180)
    at org.apache.axis2.jaxws.ExceptionFactory.makeWebSer viceException(ExceptionFactory.java:79)
    at org.apache.axis2.jaxws.ExceptionFactory.makeWebSer viceException(ExceptionFactory.java:134)
    at org.apache.axis2.jaxws.core.controller.AxisInvocat ionController.execute(AxisInvocationController.jav a:596)
    at org.apache.axis2.jaxws.core.controller.AxisInvocat ionController.doInvoke(AxisInvocationController.ja va:111)
    at org.apache.axis2.jaxws.core.controller.InvocationC ontroller.invoke(InvocationController.java:110)
    at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHand ler.invokeSEIMethod(JAXWSProxyHandler.java:275)
    at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHand ler.invoke(JAXWSProxyHandler.java:147)
    at $Proxy102.createAccount(Unknown Source)
    at servlet.ThinClientTest.invokeWS(ThinClientTest.jav a:37)
    at servlet.ThinClientTest.doPost(ThinClientTest.java: 26)
    at servlet.ThinClientTest.doGet(ThinClientTest.java:2 0)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:1075)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper.java:550)
    at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.h andleRequest(ServletWrapper.java:478)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleReques t(WebApp.java:3391)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequ est(WebGroup.java:267)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest (WebContainer.java:811)
    at com.ibm.ws.wswebcontainer.WebContainer.handleReque st(WebContainer.java:1455)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.read y(WCChannelLink.java:115)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleDiscrimination(HttpInboundLink.java:458)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleNewInformation(HttpInboundLink.java:387)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.ready(HttpInboundLink.java:267)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.sendToDiscriminators(NewConnectionIniti alReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.complete(NewConnectionInitialReadCallba ck.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListe ner.futureCompleted(AioReadCompletionListener.java :165)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallbac k(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletion Actions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture .java:136)
    at com.ibm.io.async.ResultHandler.complete(ResultHand ler.java:195)
    at com.ibm.io.async.ResultHandler.runEventProcessingL oop(ResultHandler.java:743)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler .java:873)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1473)
    Caused by: org.apache.axis2.AxisFault: HTTP ( 400 ) Bad Request address : http: //localhost:9081/bank/BankingService
    at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSend er.processStatusCode(SOAPOverHTTPSender.java:2722)
    at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSend er.send(SOAPOverHTTPSender.java:400)
    at com.ibm.ws.websvcs.transport.http.HTTPTransportSen der.invoke(HTTPTransportSender.java:292)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine .java:658)
    at org.apache.axis2.description.OutInAxisOperationCli ent.send(OutInAxisOperation.java:340)
    at org.apache.axis2.description.OutInAxisOperationCli ent.execute(OutInAxisOperation.java:304)
    at org.apache.axis2.jaxws.core.controller.AxisInvocat ionController.execute(AxisInvocationController.jav a:591)
    ... 31 more



    Also, I have generated a client from a WSDL of this web service: http://www.webservicex.net/l ength.asmx?wsdl and again in the Web Service Explorer (that as far I know use a dynamic client) works, but with the generated static client it does not work.



    My environment is:


    Websphere Application Server 6.1.0.17 (Trial)
    Web Service Feature Pack 6.1.0.17
    Rational Application Developer 7.0.0.6 (Trial)



    Thanks in advance,

    Martin



    PD: Sorry for my English! It isn't my native language

  2. Re: JAX-WS Client work over HTTPS but not over HTTP

    On 27 jun, 13:24, fulli...@gmail.com wrote:
    > Hi, I have a problem with a very simple web service example using JAX-WS.
    >
    > Basically, the problem is that if I put in the binding part of the WSDL an soap:address location with *HTTP *the static client *does not work *and throws
    >
    > *javax.xml.ws.WebServiceException: org.apache.axis2.AxisFault: HTTP ( 400 ) Bad Request address : http: //localhost:9081/bank/BankingService
    >
    > But if I only change it for *HTTPS it works . (For full explanation read below)
    >
    > Is there any config on WAS that I must change for a Client works over HTTP?... I have the default configuration of the trial WAS.
    >
    > The situation is:
    >
    > *I run a Web Service Server generated WS from a JavaBean
    > *I generate a JAX-WS Client
    > *I generate a Servlet using the WS Client that I generated before
    > *I test the WS using the Web Service Explorer and it work ok
    > *But when I test the client using the Servlet it does not work
    > *After some search, tests, read the redbooks, and many headaches I havediscovered one point:
    >
    > * *If in WSDL of the WS Server I have in the binding part pointing toa HTTPS URL it works...
    >
    > * * * * *soap:address location= "https://localhost:9444/bank/BankingService"
    >
    > * *But if I change that line for:
    >
    > * * * * *soap:address location= "http://localhost:9081/bank/BankingService"
    >
    > This simple change implies that the use of the client on the servlet workor not. This is how I use the client:
    >
    > *BankingService service = *new *BankingService();
    > BankingSEI port = service.getAccountsPort();
    > *long *result = port.createAccount( "Bob" , 1000.5);
    >
    > The full exception that I get is:
    >
    > *javax.xml.ws.WebServiceException: org.apache.axis2.AxisFault: HTTP ( 400 ) Bad Request address : http: //localhost:9081/bank/BankingService
    > * * * * at org.apache.axis2.jaxws.ExceptionFactory.createWebS erviceException(Exception*Factory.java:180)
    > * * * * at org.apache.axis2.jaxws.ExceptionFactory.makeWebSer viceException(ExceptionFa*ctory.java:79)
    > * * * * at org.apache.axis2.jaxws.ExceptionFactory.makeWebSer viceException(ExceptionFa*ctory.java:134)
    > * * * * at org.apache.axis2.jaxws.core.controller.AxisInvocat ionController.execute(Axi*sInvocationController.ja va:596)
    > * * * * at org.apache.axis2.jaxws.core.controller.AxisInvocat ionController.doInvoke(Ax*isInvocationController.j ava:111)
    > * * * * at org.apache.axis2.jaxws.core.controller.InvocationC ontroller.invoke(Invocati*onController.java:110)
    > * * * * at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHand ler.invokeSEIMethod(JAXWS*ProxyHandler.java:275)
    > * * * * at org.apache.axis2.jaxws.client.proxy.JAXWSProxyHand ler.invoke(JAXWSProxyHand*ler.java:147)
    > * * * * at $Proxy102.createAccount(Unknown Source)
    > * * * * at servlet.ThinClientTest.invokeWS(ThinClientTest.jav a:37)
    > * * * * at servlet.ThinClientTest.doPost(ThinClientTest.java: 26)
    > * * * * at servlet.ThinClientTest.doGet(ThinClientTest.java:2 0)
    > * * * * at javax.servlet.http.HttpServlet.service(HttpServlet .java:743)
    > * * * * at javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    > * * * * at com.ibm.ws.webcontainer.servlet.ServletWrapper.ser vice(ServletWrapper.java:*1075)
    > * * * * at com.ibm.ws.webcontainer.servlet.ServletWrapper.han dleRequest(ServletWrapper*.java:550)
    > * * * * at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.h andleRequest(ServletWrapp*er.java:478)
    > * * * * at com.ibm.ws.webcontainer.webapp.WebApp.handleReques t(WebApp.java:3391)
    > * * * * at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequ est(WebGroup.java:267)
    > * * * * at com.ibm.ws.webcontainer.WebContainer.handleRequest (WebContainer.java:811)
    > * * * * at com.ibm.ws.wswebcontainer.WebContainer.handleReque st(WebContainer.java:1455*)
    > * * * * at com.ibm.ws.webcontainer.channel.WCChannelLink.read y(WCChannelLink.java:115)
    > * * * * at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleDiscrimination(H*ttpInboundLink.java:458)
    > * * * * at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.handleNewInformation(H*ttpInboundLink.java:387)
    > * * * * at com.ibm.ws.http.channel.inbound.impl.HttpInboundLi nk.ready(HttpInboundLink.*java:267)
    > * * * * at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.sendToDiscrimi*nators(NewConnectionInit ialReadCallback.java:214)
    > * * * * at com.ibm.ws.tcp.channel.impl.NewConnectionInitialRe adCallback.complete(NewCo*nnectionInitialReadCallb ack.java:113)
    > * * * * at com.ibm.ws.tcp.channel.impl.AioReadCompletionListe ner.futureCompleted(AioRe*adCompletionListener.jav a:165)
    > * * * * at com.ibm.io.async.AbstractAsyncFuture.invokeCallbac k(AbstractAsyncFuture.jav*a:217)
    > * * * * at com.ibm.io.async.AsyncChannelFuture.fireCompletion Actions(AsyncChannelFutur*e.java:161)
    > * * * * at com.ibm.io.async.AsyncFuture.completed(AsyncFuture .java:136)
    > * * * * at com.ibm.io.async.ResultHandler.complete(ResultHand ler.java:195)
    > * * * * at com.ibm.io.async.ResultHandler.runEventProcessingL oop(ResultHandler.java:74*3)
    > * * * * at com.ibm.io.async.ResultHandler$2.run(ResultHandler .java:873)
    > * * * * at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1473)
    > Caused by: org.apache.axis2.AxisFault: HTTP ( 400 ) Bad Request address :http: //localhost:9081/bank/BankingService
    > * * * * at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSend er.processStatusCode(SOAP*OverHTTPSender.java:2722 )
    > * * * * at com.ibm.ws.websvcs.transport.http.SOAPOverHTTPSend er.send(SOAPOverHTTPSende*r.java:400)
    > * * * * at com.ibm.ws.websvcs.transport.http.HTTPTransportSen der.invoke(HTTPTransportS*ender.java:292)
    > * * * * at org.apache.axis2.engine.AxisEngine.send(AxisEngine .java:658)
    > * * * * at org.apache.axis2.description.OutInAxisOperationCli ent.send(OutInAxisOperati*on.java:340)
    > * * * * at org.apache.axis2.description.OutInAxisOperationCli ent.execute(OutInAxisOper*ation.java:304)
    > * * * * at org.apache.axis2.jaxws.core.controller.AxisInvocat ionController.execute(Axi*sInvocationController.ja va:591)
    > * * * * ... 31 more
    >
    > Also, I have generated a client from a WSDL of this web service: *http://www.webservicex.net/length.asmx?wsdl *and again in the Web Service Explorer (that as far I know use a dynamic client) works, but with the generated static client it does not work.
    >
    > My environment is:
    >
    > *Websphere Application Server 6.1.0.17 (Trial)
    > *Web Service Feature Pack 6.1.0.17
    > *Rational Application Developer 7.0.0.6 (Trial)
    >
    > Thanks in advance,
    >
    > Martin
    >
    > PD: Sorry for my English! It isn't my native language


    Hi Martin,
    Have you checked if the "http://localhost:9081/bank/BankingService" is
    working fine? i suggest you try it by copying the url to the address
    bar in any browser and check if you get the same (http 400) error. If
    you get same error then you will have to check the virtual hosts
    settings in websphere application server.
    To work with "localhost:9081" you should have a something like this in
    the virtual hosts list:
    localhost 9081
    * 9081

    If you dont get any error, then check for the plugin log and
    system.out.log files to verify what the error might be.

    best regards,
    Cesar

+ Reply to Thread