• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use the simpliest web server ever

 
Remi Desreumaux
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well not the simpliest but very easy

I want to be able to add two integers.
Here is my wsdl : http://intevit.com/ws/ex4/WebService.wsdl

My java code starts with :


How do I define the callbackhandler?
I guess I have to do that later :
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The callback mechanism is used for asynchronous call and depends on the SOAP stack you are using.
In case of axis2 you have to pass callback handler class as second argument while calling an operation, same as mentioned in your code. You need to implement abstract callback handler class generated by axis2 as well, to pass it as second argument.
 
Remi Desreumaux
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and nothing special in the inmplementation ? Just an empty class?
 
shivendra tripathi
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may implement onComplete, onError method defined in abstract class, based on what you want to do on getting result/error form remote service.
 
Remi Desreumaux
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shivendra tripathi wrote:The callback mechanism is used for asynchronous call and depends on the SOAP stack you are using.
In case of axis2 you have to pass callback handler class as second argument while calling an operation, same as mentioned in your code. You need to implement abstract callback handler class generated by axis2 as well, to pass it as second argument.


Hi, I can see an example right here of implementation of a callbackhandler, it seems complicated.
How do I can do to not use the async mod? thank you.

Here is my callbackhandletimpl :



and my client :


I still wonder how to display the result please.

this seems much more complicated than a .net client with the same webservice :


 
Remi Desreumaux
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read some documentation :
http://ws.apache.org/axis2/1_1_1/userguide-creatingclients.html#choosingclient

And I regenerated the stub calling :

C:\axis2-1.5.1-bin\axis2-1.5.1\bin>wsdl2java -uri http://intevit.com/ws/ex4/WebS
ervice.wsdl -p org.apache.axis2.axis2userguide -d adb -s
Using AXIS2_HOME: C:\axis2-1.5.1-bin\axis2-1.5.1
Using JAVA_HOME: C:\j\
Retrieving document at 'http://intevit.com/ws/ex4/WebService.wsdl'.
C:\axis2-1.5.1-bin\axis2-1.5.1\bin>wsdl2java -uri http://intevit.com/ws/ex4/WebS
ervice.wsdl -p org.apache.axis2.axis2userguide -d adb -s




Then in my client :


Unfortunately :

at the execution :


org.apache.axis2.AxisFault: First Element must contain the local name, Envelope , but found definitions
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:118)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.axis2userguide.Service1Stub.add(Service1Stub.java:312)
at namespace.webservice._new.Client.main(Client.java:24)
Caused by: org.apache.axiom.soap.SOAPProcessingException: First Element must contain the local name, Envelope , but found definitions
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.constructNode(StAXSOAPModelBuilder.java:267)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createOMElement(StAXSOAPModelBuilder.java:224)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createNextOMElement(StAXSOAPModelBuilder.java:196)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:207)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:161)
at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:110)
at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:682)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:210)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:140)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:103)
... 7 more


thanks for help!
 
Remi Desreumaux
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using tcp/ip monitor , I got this as request :



This looks good but the response is the wsdl itself ! Why ?


As a reminder, my client 's code is :

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic