> That said, I'm really not a fan of Sun's provider based solution.   The 
> provider stuff is "OK" but, to me, ignores many of the strengths of JAX-WS, 
> primarily the mapping to/from Java classes/interfaces and the easy 
> integration of JAXB types.   I wanted something that mapped onto the JAX-WS 
> generated classes a bit easier but would also allow some level of code first 
> capability.

I've been playing around with sun's Provider, the mapping to JAXB
isn't *very* difficult if you do wsdl-first

Create a context with the generated ObjectFactory class
    _jaxbContext = JAXBContext.newInstance(ObjectFactory.class);

Then it's almost immediate to get the java objects :
public void invoke(Source source, AsyncProviderCallback<Source> cbak,
WebServiceContext ctxt) {
    JAXBElement jaxbRequest = (JAXBElement)
_jaxbContext.createUnmarshaller().unmarshal(source);
    GetHelloWorldAsString getHelloWorldAsString =
(GetHelloWorldAsString) jaxbRequest.getValue();

Then it's "almost" the same thing for the answer :

    GetHelloWorldAsStringResponse getHelloWorldAsStringResponse =
objectFactory.createGetHelloWorldAsStringResponse();
    getHelloWorldAsStringResponse.setReturn(/*somth*/);

    JAXBElement<GetHelloWorldAsStringResponse> jaxbResponse =
objectFactory.createGetHelloWorldAsStringResponse(getHelloWorldAsStringResponse);

    ByteArrayOutputStream os = new ByteArrayOutputStream();
    _jaxbContext.createMarshaller().marshal(jaxbResponse, os);
    ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
    cbak.send(new StreamSource(is));
}

Reply via email to