I tried to make my own by generating the stub files using
WSDL2Java from the WSDL generated by Axis.

Everything seems fine, I deploy it, etc. but when I try to run the client
I get the following:

Exception in thread "main" java.lang.RuntimeException:
java.lang.RuntimeException: Unexpected subelement return
at org.apache.axis2.MyService2Stub.fromOM(MyService2Stub.java:665)
at org.apache.axis2.MyService2Stub.echo (MyService2Stub.java:144)
at org.apache.axis2.Client.main(Client.java:16)
Caused by: java.lang.RuntimeException: Unexpected subelement return
at
org.apache.axis2.MyService2Stub$EchoResponse$Factory.parse (MyService2Stub.java:419)
at org.apache.axis2.MyService2Stub.fromOM(MyService2Stub.java:657)
... 2 more


I googled it and according to
http://mail-archives.apache.org/mod_mbox/ws-axis-dev/200605.mbox/[EMAIL PROTECTED]
this is because axis does not support RPC bindings.


On 7/6/06, Anne Thomas Manes <[EMAIL PROTECTED]> wrote:
Why were you unable to generate a client using Axis2?
See http://ws.apache.org/axis2/tools/1_0/CodegenToolReference.html.

Anne

On 7/6/06, M S <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  I am a newbie trying to create a RPC-based Web Service. I created this
> using Axis2 (latest nightly build dated 5th July). The problem is that I
> cannot use WSDL2Java to generate the Client stubs. So what I did is to use
> the old Axis (1.4 from 22nd April) to do this.
>
>  For some reason I don't get it to work. My Client code looks like this:
>
>  package org.apache.ws.axis;
>
>  import javax.xml.namespace.*;
>  import javax.xml.rpc.*;
>  import java.rmi.*;
>  import java.net.*;
>
>  public class Client2 {
>
>      public Client2() {}
>
>      interface MyPrimeHandler extends Remote {
>          public String echo(String echostring) throws RemoteException;
>      }
>
>      public void invokeService() {
>          String msg = "Det funkar";
>          try {
>              String wsdlLoc =
> "http://localhost:8080/axis2/services/MyService2?wsdl ";
>              QName serviceName = new
> QName("http://localhost:8080/axis2/services/MyService2",
> "MyService2");
>              ServiceFactory sFactory = ServiceFactory.newInstance();
>              Service service = sFactory.createService(new URL(wsdlLoc),
> serviceName);
>              MyPrimeHandler mp =
> (MyPrimeHandler)service.getPort(MyPrimeHandler.class);
>              String resp = mp.echo(msg);
>              System.out.println(resp);
>          }
>
>          catch (Exception e) { e.printStackTrace();}
>      }
>
>      public static void main(String[] args) {
>          Client2 cl2 = new Client2();
>          cl2.invokeService();
>      }
>
>  }
>
>  The exception that I get is:
>
>  - Unable to find required classes (javax.activation.DataHandler and
> javax.mail.internet.MimeMultipart ). Attachment support is
> disabled.
>  javax.xml.rpc.ServiceException: Error processing WSDL document:
>  javax.xml.rpc.ServiceException: Error processing WSDL document:
>  javax.xml.rpc.ServiceException : Cannot find service:
> {http://localhost:8080/axis2/services/MyService2}MyService2
>      at
> org.apache.axis.client.Service.initService (Service.java:250)
>      at org.apache.axis.client.Service.<init>(Service.java:165)
>      at
> org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
>      at
> org.apache.ws.axis.Client2.invokeService(Client2.java:22)
>      at org.apache.ws.axis.Client2.main(Client2.java:33)
>
>
>  I have checked and the EPR exists at the specified URL above.
>
>  Does anyone have an idea on how I should solve this problem? Or am I
> barking up the wrong tree? Perhaps there is some other way generating client
> stubs with Axis2? Any help would be appreciated.
>
>  Regards
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reply via email to