hi Don;

you can write a client to consume a web service where web service only contains service.xml (no wsdl file is present) , in that case you have to create the SOAPMessge by hand , use one of the MEPClient to send the request . And all these has to handle in the your client code since you do not have stubs. In fact in M2 we have don that.and I think following code will help you to do so , and which invoke the version service.


private String value;
   private QName operationName = new QName("getVersion");
   private OMElement createEnvelope() {
       OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace("http://localhost/my";, "my");
       OMElement method = fac.createOMElement("Version", omNs);
       OMElement value = fac.createOMElement("myValue", omNs);
       method.addChild(value);
       return method;
   }

   public boolean inVokeTheService() {
       try {
           OMElement payload = createEnvelope();
           Call call = new Call();
           call.setTo(targetEPR);
call.setTransportInfo(Constants.TRANSPORT_HTTP, Constants.TRANSPORT_HTTP, false);

           OMElement result =
(OMElement) call.invokeBlocking(operationName.getLocalPart(), payload);
           StringWriter writer = new StringWriter();
result.serializeWithCache(new OMOutput(XMLOutputFactory.newInstance().createXMLStreamWriter(writer)));
           writer.flush();
           value = writer.toString();
           return true;
       } catch (AxisFault axisFault) {
           value = axisFault.getMessage();
           return false;
       } catch (XMLStreamException e) {
           value = e.getMessage();
           return false;
       }
   }


Deepal


----- Original Message ----- From: "Dong Liu" <[EMAIL PROTECTED]>
To: <[email protected]>; <[EMAIL PROTECTED]>
Sent: Tuesday, July 12, 2005 10:26 PM
Subject: Re: [axis 2]Questions on the development process using Axis 2.0


Hi, Chathura,

Thank you for your reply to my questions. Now I understand the
purposes of the different parts in the user guide of axis 2.

I like the approach that using the java classes and the service.xml to
deploy web services. But I am still thinking how to develop clients to
consume such services, if no wsdls are present. Is it possible to
develop a client just based on the service.xml?

Cheers,

Don

On 7/12/05, Chathura Herath <[EMAIL PROTECTED]> wrote:
Hi Don,

If the documentation is blurred we need to fix it, but see my comments below
for each of your queries.

> -----Original Message-----
> From: Dong Liu [mailto:[EMAIL PROTECTED]
> Sent: Monday, July 11, 2005 10:17 PM
> To: [email protected]; [email protected]
> Subject: [axis 2]Questions on the development process using Axis 2.0
>
> Hi,
>
> I am confused about the development process when using Axis 2.0. As
> described in the user guide, the process will be
>
> 1. write the class interfaces using Java;
> 2. write the service.xml;
> 3. create the .aar achieve and deploy it;
> 4. generate the skeleton code based on the *WSDL* file;
> 5. implement the logic of services;
> 6. create *another achieve* again and deploy it;
> 7. write the client code in either a dynamic or a static fashion.
>
> My questions are
>
> 1. what is purpose of the first deployment using the achieve have only
> class interfaces and service.xml?

This is an sample with no data binding(Note it echo's the OMElement. This
was the sample we had for M2 where we didn't have databinding support) So if the user want to be smart and do everyting manually that's the way to do it.
This example will tell you what are the must have's if you are to make it
work.


> 2. where does the WSDL come from? It is hard for the developer to code
> it by hand.

You of course can write it by hand, the sample is based on the fact that you
start with the contract, which is the wsdl. But.. we have a tool that does
the java2wsdl part. Actually we use the Axis1 java2wsdl tool and I belive we
have a eclipse pluigin for that too. Am I right Ajith???


> 3. what is the relationship between the first aar and the second one?

No relationship.. The second one is a databound (a more comprehensive and
practical I would say) example that emphasize the axis2 data binding
support.


In a nut shell we are not trying to invent a new development process. (But
we have our own deployment model, programming model too I would say..)


Thanks
Chathura






Reply via email to