I sent the mail before finishing it ... And so i wanted to conclude by saying that all that was left was doing some introspection glue in order to map the object to a java method.
But; yeah, there is some work to do before arriving to a "simple" method call. But it might be re-usable. I'm surprised that it's not already existing somewhere. 2012/11/12 Gege <[email protected]>: >> 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)); > }
