Announcement Announcement Module
Collapse
No announcement yet.
JaxWsPortProxyFactoryBean example throwing UnsupportedMediaException: Unsupported Con Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JaxWsPortProxyFactoryBean example throwing UnsupportedMediaException: Unsupported Con

    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:
    Code:
    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]
    XML in applicationContext.xml that defines the Jax-WS

    Code:
        <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" />
        </bean>
    Java code that does the WS call:
    Code:
    ApplicationContext context = ApplicationContextFactorySingleton.getApplicationContext();
    WhoisSoap port = (WhoisSoap) context.getBean("whoIsPort");
    System.out.println("starting ws call...");
    System.out.println(port.getWhoIS("google.com"));
    System.out.println("DONE");
    The WhoisSoap class (and other associated classes) was derived from doing a wsimport against the wsdl.

    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...
Working...
X