I'm using Spring 3.0.2 and am working through the web services referenced in the guide at 17.5.8. Accessing web services using JAX-WS. I think I've gotten everything configured as best I could but I'm getting random exceptions:
XML in applicationContext.xml that defines the Jax-WS
Exception in thread "main" org.springframework.remoting.RemoteAccessException:
Could not access remote service at [http://www.webservicex.net/whois.asmx/GetWhoIS];
nested exception is com.sun.xml.internal.ws.server.UnsupportedMediaException:
Unsupported Content-Type: text/plain; charset=utf-8 Supported ones are: [text/xml]
Java code that does the WS call:
<bean id="whoIsPort" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="net.webservicex.WhoisSoap" />
<property name="wsdlDocumentUrl" value="http://www.webservicex.net/whois.asmx?WSDL" />
<property name="namespaceUri" value="http://www.webservicex.net" />
<property name="serviceName" value="whois" />
<property name="endpointAddress" value="http://www.webservicex.net/whois.asmx/GetWhoIS" />
The WhoisSoap class (and other associated classes) was derived from doing a wsimport against the wsdl.
ApplicationContext context = ApplicationContextFactorySingleton.getApplicationContext();
WhoisSoap port = (WhoisSoap) context.getBean("whoIsPort");
System.out.println("starting ws call...");
Am I doing something wrong or missing something? Is there a better approach?
I was able to get the JAX-RPC stuff working in about five minutes and the Spring-WS WebServiceTemplate working in about 10 minutes...