Hello.  I am trying to consume the web service at:

https://ws2.ondemand.qas.com/ProOnDemand/V2/ProOnDemandService.asmx?WSDL

I generated code using:

wsdl2java -d attempt2/ -client -validate -verbose -exsh true
https://ws2.ondemand.qas.com/ProOnDemand/V2/ProOnDemandService.asmx?WSDL

However, I kept getting:

Exception in thread "main"
com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport
error: java.net.ConnectException: Connection timed out

Debugging lead me to see that I was attempting open a conection to
ws2.ondemand.qas.com on port 8152.  This presumably comes from the WSDL:

  <wsdl:service name="OnDemandIntermediaryV2">
    <wsdl:port name="QASOnDemand" binding="tns:QASOnDemand">
      <soap:address location="
https://ws2.ondemand.qas.com:8152/ProOnDemand/V2/ProOnDemandService.asmx"; />
    </wsdl:port>

but I believe it to be wrong: the server is not listening there.  I tried
following the directions to alter the "service address" (I assume that's the
proper nomenclature for what I'm trying to do: all this web service stuff is
new to me):

http://docs.huihoo.com/apache/cxf/2.2.4/client-http-transport-including-ssl-support.html

in the subsection titled "How to override the service address?" but was not
successful.  I don't see that javax.xml.ws.Service has a getServicePort()
method as used in the first example, I see nothing about
JaxWsProxyFactoryBean in the code like in the second example, and attempting
to add a port led to a WebServiceException about how the new port was not
valid: it seems like the portName argument needs to be one in the WSDL but
yet I couldn't replace one of the existing ones with a new one.

ANYWAY, I decided to try simply copying the WSDL to my local box (running
Apache) and then change it like so:

--- a/original_wsdl 2011-01-06 13:22:55.997881804 -0700
+++ b/wsdl 2011-01-12 13:57:43.666573012 -0700
@@ -899,10 +899,10 @@
   </wsdl:binding>
   <wsdl:service name="OnDemandIntermediaryV2">
     <wsdl:port name="QASOnDemand" binding="tns:QASOnDemand">
-      <soap:address location="
https://ws2.ondemand.qas.com:8152/ProOnDemand/V2/ProOnDemandService.asmx"; />
+      <soap:address location="
https://ws2.ondemand.qas.com/ProOnDemand/V2/ProOnDemandService.asmx"; />
     </wsdl:port>
     <wsdl:port name="QASOnDemand1" binding="tns:QASOnDemand1">
-      <soap12:address location="
https://ws2.ondemand.qas.com:8152/ProOnDemand/V2/ProOnDemandService.asmx"; />
+      <soap12:address location="
https://ws2.ondemand.qas.com/ProOnDemand/V2/ProOnDemandService.asmx"; />
     </wsdl:port>
   </wsdl:service>

and then instantiate my client via:

        OnDemandIntermediaryV2 ss = new OnDemandIntermediaryV2(new URL("
http://localhost/~rcrocomb/wsdl.txt";));
        QASOnDemand port = ss.getQASOnDemand();

rather than via:

        OnDemandIntermediaryV2 ss = new OnDemandIntermediaryV2();
        QASOnDemand port = ss.getQASOnDemand();

This works.  So my question would be:

How do I achieve this same result without having to host the modified WSDL?

Thanks!

-- 
Robert Crocombe

Reply via email to