Hi Nikola,
Yes there is an API change of the client api between the two releases,
0.92 and 0.93. Rather than setting your options directly to the Call or
the stub object, you need to set that to Options object and then pass it
on to Call or Stub.
There is an Options object by default in every Stub, which has some
default values initialy. When you create your own Options object for
each invocation, Axis2 should correctly handle those. The bug is because
this is not handled well in one instance.
So please use our nightly builds. Anyway, we gonna release the next
version ASAP.
Sorry for any inconvenience :-)
-- Chinthaka
Nikola Zifra wrote:
>Hi iksrazal and Chintaka,
> this is the part of the stub code generated by the 0.92 version of the
> WSDL2Java tool:
>
> org.apache.axis2.clientapi.Call _call = new
> org.apache.axis2.clientapi.Call(_serviceContext);
>
> _call.setTransportInfo(this.senderTransport,this.listenerTransport,this.useSeparateListener);
> _call.setDoREST(this.doRest);
>
> org.apache.axis2.context.MessageContext _messageContext =
> getMessageContext();
> _call.setTo(this.toEPR);
> _call.setSoapAction("echoString");
>
> And this is the part generated by 0.93 version of WSDL2Java tool:
>
> org.apache.axis2.client.Call _call = new
> org.apache.axis2.client.Call(_serviceContext);
> _call.setClientOptions(_clientOptions);
> org.apache.axis2.context.MessageContext _messageContext =
> getMessageContext();
> if(_clientOptions.getSoapAction() == null) {
>
> }
>
> if(_clientOptions.getAction() == null) {
>
> }
>
> Notice that two different Call classes with different APIs are used in 0.92
> and 0.93 version of the generated stub.You can't add line
> _call.setSoapAction("echoString") to the 0.93 version gen code because the
> org.apache.axis2.client.Call used in the 0.93 does not have method
> setSoapAction() . You can just use
> _clientOptions.setSoapAction("echoString") but it seems that it does not
> resolve my issue, because I am still getting
> the exception I've complained about.
>
> When I modify the 0.93 version code like this i am still getting the
> exception:
>
> rg.apache.axis2.client.Call _call = new
> org.apache.axis2.client.Call(_serviceContext);
> _call.setClientOptions(_clientOptions);
> org.apache.axis2.context.MessageContext _messageContext =
> getMessageContext();
> if(_clientOptions.getSoapAction() == null) {
> System.out.println("\n\n\n>>> SETTING SOAP ACTION");
> _clientOptions.setSoapAction("echoString");
> }
>
> org.apache.axis2.AxisFault: org.apache.axis2.AxisFault: Operation Not found
> EPR is http://localhost:8080/axis2/services/Axis2SampleDocLitPortType and
> WSA Action =
> at
> org.apache.axis2.engine.DispatchingChecker.invoke(DispatchingChecker.java:70)
> at org.apache.axis2.engine.Phase.invoke(Phase.java:167)
> at org.apache.axis2.engine.AxisEngine.invokePhases(AxisEngine.java:443)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:137)
>
> When I modify the 0.93 code in the following manner :
>
> org.apache.axis2.client.Call _call = new
> org.apache.axis2.client.Call(_serviceContext);
> _call.setClientOptions(_clientOptions);
>
> org.apache.axis2.context.MessageContext _messageContext =
> getMessageContext();
> _clientOptions.setSoapAction("echoString");
> if(_clientOptions.getSoapAction() == null) {
>
>
> }
>
> if(_clientOptions.getAction() == null) {
>
> }
> I got the the following exception:
>
> org.apache.axis2.AxisFault: null; nested exception is:
> java.lang.NullPointerException
> at org.apache.axis2.AxisFault.makeFault(AxisFault.java:190)
> at
> org.apache.axis2.userguide.Axis2SampleDocLitPortTypeMessageReceiver.invokeBusinessLogic(Axis2SampleDocLitPortTypeMessageReceiver.java:120)
> at
> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:36)
> ....
> Caused by: java.lang.NullPointerException
> at
> org.apache.axis2.userguide.databinding.Axis2SampleDocLitPortTypeechoStringDatabindingSupporter.toOM(Axis2SampleDocLitPortTypeechoStringDatabindingSupporter.java:34)
> at
> org.apache.axis2.userguide.Axis2SampleDocLitPortTypeMessageReceiver.invokeBusinessLogic(Axis2SampleDocLitPortTypeMessageReceiver.java:106)
> ... 20 more
>
> Could you pls. be more specific what part of the generated code should I
> modify and how?
>
> Regards,
> Nikola
>
>
>
>
>
>
>Eran Chinthaka <[EMAIL PROTECTED]> wrote: -----BEGIN PGP SIGNED
>MESSAGE-----
> Hash: SHA1
>
> Nikola, the iksrazal's method will fix the problem, BUT ..............
> I should accept that its a bug in 0.93 release, which is now fixed in
> current SVN head.
>
> - -- Chinthaka
>
> iksrazal wrote:
>
> > Nikola,
>
> >
>
> > Try following this thread - worked for me when I had a similiar
>
> > problem:
>
> >
>
> >
> http://marc.theaimsgroup.com/?l=axis-user&m=113474706726344&w=2
>
> >
>
> > HTH, iksrazal
>
> >
>
> > Em Terça 27 Dezembro 2005 08:48, o Nikola Zifra escreveu:
>
> >
>
> >> Hi I am getting following exception when I try to run the
> code
>
> >> generated by WSDL2Java tool.
>
> >>
>
> >> - Invoking Handler 'AddressingOutHandler' in Phase
> 'MessageOut' -
>
> >> Build the OMElelment EnvelopeBy the StaxSOAPModelBuilder -
>
> >> Starting Process SOAP 1.1 message - Build the OMElelment
> HeaderBy
>
> >> the StaxSOAPModelBuilder - Build the OMElelment BodyBy the
>
> >> StaxSOAPModelBuilder - Invoking Handler
> 'AddressingInHandler' in
>
> >> Phase 'PreDispatch' org.apache.axis2.AxisFault:
>
> >> org.apache.axis2.AxisFault: Operation Not found EPR is
>
> >>
> http://localhost:8080/axis2/services/Axis2SampleDocLitPortType
>
> >> and WSA Action = at
>
> >>
> org.apache.axis2.engine.DispatchingChecker.invoke(DispatchingChecker.java:7
>
> >> 0) at org.apache.axis2.engine.Phase.invoke(Phase.java:167)
> at
>
> >>
> org.apache.axis2.engine.AxisEngine.invokePhases(AxisEngine.java:443)
>
> >> at
>
> >>
> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:137)
>
> >> at
>
> >>
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(H
>
> >> TTPTransportUtils.java:211) at
>
> >>
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:181)
>
> >> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>
> >> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>
> >> at
>
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio
>
> >> nFilterChain.java:252) at
>
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
>
> >> hain.java:173) at
>
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
>
> >> ava:213) at
>
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j
>
> >> ava:178) at
>
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:12
>
> >> 6) at
>
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:10
>
> >> 5) at
>
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav
>
> >> a:107) at
>
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>
> >> at
>
> >>
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>
> >> at
>
> >>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConn
>
> >> ection(Http11Protocol.java:744) at
>
> >>
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.ja
>
> >> va:527) at
>
> >>
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerW
>
> >> orkerThread.java:80) at
>
> >>
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.ja
>
> >> va:684) at java.lang.Thread.run(Thread.java:595) ; nested
>
> >> exception is: java.lang.Exception:
> org.apache.axis2.AxisFault:
>
> >> Operation Not found EPR is
>
> >>
> http://localhost:8080/axis2/services/Axis2SampleDocLitPortType
>
> >> and WSA Action = at
>
> >>
> org.apache.axis2.engine.DispatchingChecker.invoke(DispatchingChecker.java:7
>
> >> 0) at org.apache.axis2.engine.Phase.invoke(Phase.java:167)
> at
>
> >>
> org.apache.axis2.engine.AxisEngine.invokePhases(AxisEngine.java:443)
>
> >> at
>
> >>
> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:137)
>
> >> at
>
> >>
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(H
>
> >> TTPTransportUtils.java:211) at
>
> >>
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:181)
>
> >> at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>
> >>
>
> >>
>
> >> I have used the sample WSDL file Axis2SampleDocLit.wsdl from
> the
>
> >> Axis2 binary distribution (version 0.93). I am running the
>
> >> WSDL2Java using following Ant target:
>
> >>
>
> >> <target name="wsdl2java" depends="clean,prepare">
> <delete
>
> >> dir="output" /> <mkdir dir="output"/> <java
>
> >> classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
>
> >> <classpath refid="axis.classpath"/> <arg
> value="-uri"/>
>
> >>
>
> >> <arg file="wsdl/Axis2SampleDocLit.wsdl"/> <arg
> value="-ss"/> <arg
>
> >> value="-sd"/> <arg value="-o"/> <arg
> file="output"/> <arg
>
> >> value="-p"/> <arg
> value="org.apache.axis2.userguide"/> </java>
>
> >>
>
> >> <!-- Move the schema folder to classpath--> <move
>
> >> todir="${build.classes}"> <fileset dir="output">
> <include
>
> >> name="**/*schema*/**/*.class"/>
>
> >>
>
> >> <include name="**/*schema*/**/*.xsb"/>
> </fileset> </move>
>
> >>
>
> >> </target>
>
> >>
>
> >> The code generation executes without errors and following
>
> >> service.xml file is generated:
>
> >>
>
> >> <!--Auto generated Axis Service XML--> <service
>
> >> name="Axis2SampleDocLitPortType"> <parameter
> locked="false"
>
> >>
> name="ServiceClass">org.apache.axis2.userguide.Axis2SampleDocLitPortTypeSke
>
> >> leton</parameter> <!--Mounting the method
> echoStringArray-->
>
> >> <operation name="echoStringArray"> <messageReceiver
>
>
> >>
> class="org.apache.axis2.userguide.Axis2SampleDocLitPortTypeMessageReceiver"
>
> >> /> </operation> <!--Mounting the method
> echoStruct--> <operation
>
> >> name="echoStruct"> <messageReceiver
>
> >>
> class="org.apache.axis2.userguide.Axis2SampleDocLitPortTypeMessageReceiver"
>
> >> /> </operation> <!--Mounting the method
> echoString--> <operation
>
> >> name="echoString"> <messageReceiver
>
> >>
> class="org.apache.axis2.userguide.Axis2SampleDocLitPortTypeMessageReceiver"
>
> >> /> </operation> </service>
>
> >>
>
> >> The client code looks like this:
>
> >>
>
> >> try { //Create the stub by passing the AXIS_HOME and target
> EPR.
>
> >> //We pass null to the AXIS_HOME and hence the stub will use
> the
>
> >> current directory sa the AXIS_HOME
> Axis2SampleDocLitPortTypeStub
>
> >> stub= new Axis2SampleDocLitPortTypeStub(null,
>
> >>
> "http://localhost:8080/axis2/services/Axis2SampleDocLitPortType");
>
> >> //Create the request document to be sent.
> EchoStringParamDocument
>
> >> reqDoc= EchoStringParamDocument.Factory.newInstance();
>
> >> reqDoc.setEchoStringParam("Axis2 Echo"); //invokes the web
>
> >> service. EchoStringReturnDocument
> resDoc=stub.echoString(reqDoc);
>
> >> System.out.println(resDoc.getEchoStringReturn());
>
> >>
>
> >> } catch (Exception e) { e.printStackTrace(); }
>
> >>
>
> >> Used sample WSDL is in the attachment.
>
> >>
>
> >> Regards, Nikola
>
> >>
>
> >>
>
> >>
>
> >>
>
> >>
>
> >>
>
> >> --------------------------------- Yahoo! Shopping Find Great
>
> >> Deals on Holiday Gifts at Yahoo! Shopping
>
> >
>
> >
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2 (MingW32)
>
> iD8DBQFDsT/PjON2uBzUhh8RAoe8AJoDStE53vfHgUy5k6r3uV9yAcXFSgCeMOln
> gb3wFBjSBPg9oPTohBjYi8Q=
> =qj6O
> -----END PGP SIGNATURE-----
>
>
>
>
>
>---------------------------------
> Yahoo! DSL Something to write home about. Just $16.99/mo. or less
>
>