Topic
  • 4 replies
  • Latest Post - ‏2013-04-29T02:54:24Z by HX94_John_Resler
SystemAdmin
SystemAdmin
9029 Posts

Pinned topic Can't connect using java.net.URL from within Portal Server

‏2013-04-04T21:40:38Z |
Hi,
I have written a web service client using JAXWS that is intended to run within the Portal Server (7.0). I receive SAXParserExceptions from the client though and I've traced it down to being unable to read from the URL endpoint from within the application server. I already have a home rolled REST client that connects fine from within the server so I do not understand why this problem would occur. I get no exceptions when I write a simple method as indicated below.
public static void copy() {
try {
URL u = new URL("http://server:port/correlationid/RetrieveService?WSDL");
StreamCopier.copy(u.openStream(), System.out);
} catch (Throwable t) {
t.printStackTrace();
}
}

The same method run from the command line on the same machine works fine (returns the WSDL) so it is not a DNS issue or an issue with the service being down. I'd get an IOException if either of these were the case. When I use the InputStream.available() method, it returns 0 bytes. If anyone has any ideas at all, I'd be grateful. I'm really stymied by this. Thanks in advance.
Updated on 2013-04-05T13:21:46Z at 2013-04-05T13:21:46Z by DGawron
  • mburati
    mburati
    2561 Posts

    Re: Can't connect using java.net.URL from within Portal Server

    ‏2013-04-05T02:55:28Z  
    I'm sorry, I don't understand what's going on just from that information.

    Is this web app generated with Web Experience Factory (which this forum is for discussion of)?
    I don't see any reference to anything Web Experience Factory specific in that description, so I'm wondering if it's even related or if you landed in this particular forum by accident.

    Does the JAXWS client code run outside of portal/portlet (eg, via a servlet on WAS or standalone client)?
    If not and this is not WEF specific then you may want to try a WAS WS specific forum.

    I hope that info helps,
    ..Mike Burati
    http://www-10.lotus.com/ldd/pfwiki.nsf/
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
  • SystemAdmin
    SystemAdmin
    9029 Posts

    Re: Can't connect using java.net.URL from within Portal Server

    ‏2013-04-05T03:33:46Z  
    • mburati
    • ‏2013-04-05T02:55:28Z
    I'm sorry, I don't understand what's going on just from that information.

    Is this web app generated with Web Experience Factory (which this forum is for discussion of)?
    I don't see any reference to anything Web Experience Factory specific in that description, so I'm wondering if it's even related or if you landed in this particular forum by accident.

    Does the JAXWS client code run outside of portal/portlet (eg, via a servlet on WAS or standalone client)?
    If not and this is not WEF specific then you may want to try a WAS WS specific forum.

    I hope that info helps,
    ..Mike Burati
    http://www-10.lotus.com/ldd/pfwiki.nsf/
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.
    I can see how that question would arise given the nature of it. Yes, the web service client is being invoked from a portlet factory war but the URL object although not failing, is also not receiving any data on the stream in the portlet. I have tested this and outside the portal server it connects, inside the portal server it does not. I thought perhaps there was a security setting I had missed but I would have expected that to have raised an exception in and of itself.
  • DGawron
    DGawron
    580 Posts

    Re: Can't connect using java.net.URL from within Portal Server

    ‏2013-04-05T13:21:46Z  
    If I understand correctly you have written a JAX-WS client in Java and are not using a Web Service Call or Web Service MultiOp builder. For diagnostic purposes, if you tried one of those builders with the WSDL URL would it work in Portal? If it does, then the issue probably lies in how the client is written and indicates an incompatibility between the client and the JAX-WS implementation provided by WebSphere.

    One thing to keep in mind is that the JAX-WS implementation provided by WebSphere may be different from the JAX-WS implementation you get when running the client directly with a JDK.

    You didn't say what tooling you used to create the client. Was it 'wsimport' from the JDK used by WebSphere/Portal or another tool/method?

    This sounds like a question better suited to a WebSphere forum since your client is using WebSphere's JAX-WS implementation directly.
  • HX94_John_Resler
    HX94_John_Resler
    1 Post

    Re: Can't connect using java.net.URL from within Portal Server

    ‏2013-04-29T02:54:24Z  
    • DGawron
    • ‏2013-04-05T13:21:46Z
    If I understand correctly you have written a JAX-WS client in Java and are not using a Web Service Call or Web Service MultiOp builder. For diagnostic purposes, if you tried one of those builders with the WSDL URL would it work in Portal? If it does, then the issue probably lies in how the client is written and indicates an incompatibility between the client and the JAX-WS implementation provided by WebSphere.

    One thing to keep in mind is that the JAX-WS implementation provided by WebSphere may be different from the JAX-WS implementation you get when running the client directly with a JDK.

    You didn't say what tooling you used to create the client. Was it 'wsimport' from the JDK used by WebSphere/Portal or another tool/method?

    This sounds like a question better suited to a WebSphere forum since your client is using WebSphere's JAX-WS implementation directly.

    It appears the URL was not following a redirect to the actual WSDL location. The connection was not failing.