axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yoav Abrahami" <yoa...@gmail.com>
Subject Re: J2BX feature request/questions
Date Sun, 24 Aug 2008 18:01:31 GMT
Hi John,

Thanks for looking at the J2XB library and the integration with Axis2.

About your comments -
1. Injecting comments to the generated XML Schema is a good idea. I will add
it to the J2XB schema generation options. I think about adding a new
annotation that it's content will be added as an XML Schema annotations.

Maybe something like (for single annotations)
*@MoXmlAnnotation(type=documentation, value="...")

*and for multiple annotations
@MoXmlAnnotations( value = {
  *@MoXmlAnnotation(type=documentation, value="...")
  **@MoXmlAnnotation(type=appInfo, value="...")*
})


2. The generation of the Endpoints section in the WSDL is done automatically
by Axis2 - I do not modify the default behavior of Axis2. I believe that
Axis2 has the ability to expose the same service as both.


3. Good idea. I had not tried to do the client side because there are other
solutions that generate the client side from the WSDL, where there are not
good alternative to generate the WSDL from the server code. However, I can
see the logic, in some cases, to have the client use the same POJOs as the
server, using the same annotations. I will add this support soon - you are
actually invited to help if you like.



About the code you wrote -  You got the code almost right. However, because
Axis2 wraps the J2XB XML with a request - response XML element, the
client-side code will be a little more complicated. I will prepare an
example and send another email later this week.

For the code sample you sent, I think you should replace the lines (if I
understand right what you are trying to do)

* XmlAxiomFactory fac = XmlAxiomFactory.getInstance();
MoXmlBeanDescriptor beanDesc = new MoXmlBeanDescriptor(**
xmlBindingModel.getSchema(**OpenManualReceiverControlReque**
stType.class),xmlBindingModel.**getBeanDescriptor(**
OpenManualReceiverControlReque**stType.class) );
XmlAxiomDocumentContext doc = (XmlAxiomDocumentContext)fac.**
createXmlDocument(**xmlBindingModel.getSchema(**
OpenManualReceiverControlReque**stType.class),beanDesc );
OMElement openReq = doc.getDocumentInstance();*

with

*                // get the bean descriptor
                MoXmlSchema xmlSchema =
xmlBindingModel.getSchema(request.getClass());
                MoXmlBeanDescriptor xmlDescriptor =
xmlSchema.getXmlBeanDescriptor(request.getClass());
                XmlAxiomFactory xmlAxiomFactory =
XmlAxiomFactory.getInstance();
                // write the instance to XML
                XmlAxiomDocumentContext document =
(XmlAxiomDocumentContext)xmlDescriptor.persistInstance(xmlAxiomFactory,
request);

                // do the WS call
                OMElement openReq = document.getDocumentInstance();
*

Cheers,
  Yoav



On Fri, Aug 22, 2008 at 10:41 PM, John Helewa <helewa@kablab.com> wrote:

>  Yoav;
>
> I really like what you have done with J2BX and especially the Axis2
> integration. I've converted one service over from regular Axis2 POJO to J2BX
> and it works great.
>
> 1) Would be nice to add the ability to inject "comments" or XML Schema
> annotation comments into the schema or service. That way you can document
> the WSDL from your POJO.
> 2) Not sure about the generation of SOAP11Endpoints and SOAP12Endpoints
> inside the same WSDL. Aren't these two formats incompatible? So really you
> are just using SOAP11 at this time?
> 3) Would be nice to know how to do POJO based web service invocation from a
> client. That way the same POJOs used to generate the service can be used
> within the client. In Axis2, we used the RPCServiceClient.invokeBlocking
> calls with POJOs to get things to work. It would be good to have a
> RPCJ2BX.invoke*() set of methods to mirror this.
>
> Question:
> =======
> I am try to write a client access library for POJOs like Axis2 provides.
> Any pointers would help. I provide the library to you if I get it working.
> Here is a code clip at a non-working attempt to invoke a J2BX service using
> a POJOs:
>
> MoXmlBindingModel xmlBindingModel = new MoXmlBindingModel();
> try {
> OpenManualReceiverControlRequestType request = new
> OpenManualReceiverControlRequestType();
> request.set*****;
>
> xmlBindingModel.addBean(OpenManualReceiverControlRequestType.class);
> try {
> XmlAxiomFactory fac = XmlAxiomFactory.getInstance();
> MoXmlBeanDescriptor beanDesc = new
> MoXmlBeanDescriptor(xmlBindingModel.getSchema(OpenManualReceiverControlRequestType.class),xmlBindingModel.getBeanDescriptor(OpenManualReceiverControlRequestType.class)
> );
> XmlAxiomDocumentContext doc =
> (XmlAxiomDocumentContext)fac.createXmlDocument(xmlBindingModel.getSchema(OpenManualReceiverControlRequestType.class),beanDesc
> );
> OMElement openReq = doc.getDocumentInstance();
> Options options = new Options();
> EndpointReference epr = new EndpointReference("
> http://localhost/axis2/services/ManualReceiverControlService.ManualReceiverControlServiceHttpSoap11Endpoint
> ");
> options.setTo(epr);
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>
> ServiceClient sender = new ServiceClient();
> sender.setOptions(options);
>
>
> OMElement result = sender.sendReceive(openReq);
>
> String response = result.getFirstElement().getText();
> System.err.println(response);
>
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> Thanks;
>
> John Helewa
> KAB Laboratories, Inc
> helewa@kablab.com
> (KAB Main) 619-523-1763 (x702)
> (Mobile) 619-246-8846
> http://www.kablab.com
>
>

Mime
View raw message