dev@jax-ws.java.net

Dispatch with JAXBContext Problem

From: <mark_at_javector.com>
Date: Wed, 04 Jan 2006 10:39:11 -0700

I'm using the JAX-WS version in Glassfish (built yesterday from source). Even
though I create the Dispatch with a JAXBContext, it is returning a
StreamSource. Is this the intended behavior when doing an HTTP "GET"?

Here is code:

    JAXBContext jc =
      JAXBContext.newInstance("com.example.oms:com.example.css");
    // Get the new orders
    Service svc = Service.create(svcQName);
    svc.addPort(orderQName, HTTPBinding.HTTP_BINDING, newOrdersUrl);
    Dispatch<Object> getOrdersDispatch =
      svc.createDispatch(orderQName, jc, Service.Mode.PAYLOAD);
    Map<String, Object> requestContext = getOrdersDispatch.getRequestContext();
    requestContext.put(MessageContext.HTTP_REQUEST_METHOD, "GET");
    JAXBElement<OrdersType> newOrdersElt =
      (JAXBElement<OrdersType>) getOrdersDispatch.invoke(null);

Here is run time error:

    [java] Exception in thread "main" java.lang.ClassCastException:
javax.xml.transform.stream.StreamSource
    [java] at samples.OrderToCustHistJAXB.main(OrderToCustHistJAXB.java:45)