users@jax-ws.java.net

Endpoint.setMetadata(...) problem

From: <mark_at_javector.com>
Date: Wed, 15 Feb 2006 11:38:34 -0700

I'm getting a MalformedURLException when I try to publish an Endpoint after
setting its metadata. This does not happen if I don't set the metadata.

I am running Mustang binary distribution from Feb 9th.

I have a hunch that this is happening because I have not set the systemId
property on the metadata Source. But, I don't have a clue how to do that. The
metadata is a WSDL file inside the JAR (I am running this as a main class inside
a JAR).

Here is code:

    Endpoint endpoint = Endpoint.create(new RequestOrder());
    InputStream wsdlStream =
      Client.class.getClassLoader().getResourceAsStream("RequestOrder.wsdl");
    if ( wsdlStream == null ) {

      throw new RuntimeException("Cannont find WSDL resouce file.");
    }
    ArrayList<Source> metadata = new ArrayList<Source>();
    metadata.add(new StreamSource(wsdlStream));
    endpoint.setMetadata(metadata);
    endpoint.publish("http://localhost:8680/oms");

Here is error trace:

    [java] Exception in thread "main" Server Runtime Error:
java.net.MalformedURLException
    [java] at
com.sun.xml.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:185)
    [java] at
com.sun.xml.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:65)
    [java] at samples.Client.main(Client.java:39)
    [java] Caused by: java.net.MalformedURLException
    [java] at java.net.URL.<init>(URL.java:601)
    [java] at java.net.URL.<init>(URL.java:464)
    [java] at java.net.URL.<init>(URL.java:413)
    [java] at
com.sun.xml.ws.transport.http.server.HttpEndpoint.setDocInfo(HttpEndpoint.java:109)
    [java] at
com.sun.xml.ws.transport.http.server.HttpEndpoint.fillEndpointInfo(HttpEndpoint.java:155)
    [java] at
com.sun.xml.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:220)
    [java] at
com.sun.xml.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:179)
    [java] ... 2 more
    [java] [ERROR] Java Result: 1