3 Replies Latest reply on Aug 30, 2006 10:58 AM by hessman

    Problem with wsdl, accessing a WebMethod in a statelessSessi

    hessman

      Hello...dunno if this is the right board since i saw there is a JBOSS.NET board as well. I hope it will fit in here.


      actually i'am using EJB 3.0 and trying to access a simple HelloWorld method from a C# Client. But it seems that the *.wsdl file which is generated by my annotations does'nt work properly. The created ws has some problems in the root elements...in my C# Client he thinks that my HelloWorld method is a class as well as the class himself and expect a object with the methodname as a parameter. strange.

      Furthermore i have to tell you that i've tried to do the same with glassfish and it works. So i think there might be problems with the generated wsdl or some flag i did'nt set. Even though i dont believe that i'am the first who is trying to connect a c# client with a java-based middleware with jboss... ;)

      afaik for a .NET environment i need to change the soapBinding to @SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED) . I changed the method names to uppercase because i think .net expect this. (glassfish is working with the same SOAPBinding setup)

      my testing class:


      @Stateless
      @WebService
      @SOAPBinding(style=Style.DOCUMENT, use=Use.LITERAL, parameterStyle=ParameterStyle.WRAPPED)
      public class CustomersSessionBean {
       public void addCustomer(Customer customer) {
       System.out.println("test");
       }
      
       public Customer loadCustomer() {
       System.out.println("test");
       return null;
       }
      
       @WebMethod(operationName="HelloWorld")
       @WebResult(name="Hello")
       public String HelloWorld(){
       return "Hello World";
       }
      }


      i've created the same class in .NET and let them generate a localhost webservice to compare both *.wsdl files.


      to watch the following *.wsdl files you need the IE...opera does'nt work with them unfortunatly (ff i dont know)


      jboss generated wsdl: http://www.dowhilefalse.com/wsdl/jboss.wsdl
      loc: 46

      .NET generated wsdl: http://www.dowhilefalse.com/wsdl/dotnet.wsdl
      loc: 46

      glassfish generated wsdl: http://www.dowhilefalse.com/wsdl/glassfish.wsdl
      loc: 36 O_O

      btw to write the wsdl's manually is no option!



      best thx and greetings from germany

      D. Hesse


      P.S. i apologize for my intermediate english skills.




        • 1. Re: Problem with wsdl, accessing a WebMethod in a statelessS
          hessman

          I found out that the problem is in the wsdl at line 18.

          <message name="CustomersSessionBean_HelloWorldResponse">
           <part name="result" element="s0:HelloWorldResponse" />
           </message>


          The error is the "name" attribute. It should be called "parameters".

          <message name="CustomersSessionBean_HelloWorldResponse">
           <part name="parameters" element="s0:HelloWorldResponse" />
           </message>



          My new question is: How can i change that behaviour on JBOSS?

          • 2. Re: Problem with wsdl, accessing a WebMethod in a statelessS
            doug.palmer

            Interesting, where do you get the wsdl from? You are already doing the correct thing to rename return but you name it "Hello". Hence, your generated wsdl should read:

            <message name="CustomersSessionBean_HelloWorldResponse">
             <part name="Hello" element="s0:HelloWorldResponse" />
            </message>
            


            If you inserted @WebResult(name="parameters") then you should get:
            <message name="CustomersSessionBean_HelloWorldResponse">
             <part name="parameters" element="s0:HelloWorldResponse" />
            </message>
            


            This definitely works with JBossWS-1.0.2.

            Regards
            Doug

            • 3. Re: Problem with wsdl, accessing a WebMethod in a statelessS
              hessman

              Firstly Doug i have to say thankya for your reply.


              Nevertheless it isn't working in that way. I've changed my method from

              @WebMethod(operationName="HelloWorld")
              @WebResult(name="Hello")
              public String HelloWorld(){
               return "Hello World";
              }
              

              to
              @WebMethod(operationName="HelloWorld")
              @Webresult(name="parameters")
              public String HelloWorld(){
               return "Hello World";
              }


              and all what had changed was line 9 to 11 in the jboss.wsdl from hello to parameters

              <s:sequence>
              <s:element name="hello" nillable="true" type="s:string" />
              </s:sequence>


              As far as i can see there are no other changes in the wsdl document. I think the @WebResult annotation has no impact on the
              <message name="CustomersSessionBean_HelloWorldResponse">
               <part name="result" element="s0:HelloWorldResponse" />
              </message>

              name attribute within the part tag. to alter this entry from result to parameters would be great. Any hints how to change that would be appreciated. Thank you.

              best greetings from hamburg

              Dirk