2 Replies Latest reply: Aug 25, 2014 11:57 PM by vladodias RSS

    Problem accessing third party secure web service using https in weblogic server

    2734482


      I can successfully access the third party secure web service using Tomcat but when I try accessing same web service on weblogic I am getting following exception:-

       

      javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://www.abc.com/orders/submit/service?wsdl. It failed with:

              Response: '401: Unauthorized' for url: 'https://www.abc.com/orders/submit/service?wsdl'.

              at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:172)

              at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:153)

              at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:273)

              at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:236)

              at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:184)

              at weblogic.wsee.jaxws.spi.WLSServiceDelegate.<init>(WLSServiceDelegate.java:42)

              at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.<init>(WLSProvider.java:206)

              at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:57)

              at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:41)

              at javax.xml.ws.Service.<init>(Service.java:56)

              at com.medplus.orders.OrderSubmissionService.<init>(OrderSubmissionService.java:42)

              at com.adamsoft.edoc.util.QuestOrderService.sendOrder(QuestOrderService.java:137)

              at com.adamsoft.edoc.util.QuestOrderService.run(QuestOrderService.java:308)

              at java.util.TimerThread.mainLoop(Timer.java:512)

              at java.util.TimerThread.run(Timer.java:462)

      Caused by: java.io.FileNotFoundException: Response: '401: Unauthorized' for url: 'https://www.abc.com/orders/submit/service?wsdl'

              at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:474)

              at weblogic.net.http.SOAPHttpsURLConnection.getInputStream(SOAPHttpsURLConnection.java:37)

              at java.net.URL.openStream(URL.java:1010)

              at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:843)

              at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:289)

              at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:138)

              at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:273)

              at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:237)

              at com.sun.xml.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:187)

              at weblogic.wsee.jaxws.spi.WLSServiceDelegate.<init>(WLSServiceDelegate.java:36)

              at weblogic.wsee.jaxws.spi.WLSProvider$ServiceDelegate.<init>(WLSProvider.java:207)

              at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:57)

              at weblogic.wsee.jaxws.spi.WLSProvider.createServiceDelegate(WLSProvider.java:41)

              at javax.xml.ws.Service.<init>(Service.java:56)

              at com.medplus.orders.OrderSubmissionService.<init>(OrderSubmissionService.java:43)

              at com.adamsoft.edoc.util.QuestOrderService.sendOrder(QuestOrderService.java:137)

              at com.adamsoft.edoc.util.QuestOrderService.run(QuestOrderService.java:310)

              ... 2 more

       

       

      I tried following two different snippet of code to access the web service:-

       

      Code Snippet 1

      service = Service.create(new URL(END_POINT + "?wsdl"), new QName("http://abc.com/orders", "OrderSubmissionService"));

      port = service.getPort(OrderSubmissionPortType.class);

      Map<String, Object> requestContext = ((BindingProvider) port).getRequestContext();

      requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, END_POINT + "?wsdl");

      requestContext.put(BindingProvider.USERNAME_PROPERTY, USERNAME);

      requestContext.put(BindingProvider.PASSWORD_PROPERTY, PASSWORD);

       

       

      Code Snippet 2

       

       

       

      service = new OrderSubmissionService(new URL(END_POINT + "?wsdl"), new QName("http://abc.com/orders", "OrderSubmissionService"));

      OrderSubmissionPortType port = service.getOrderSubmissionPortTypePort();

       

      Please help me in resolving the issue.