5 Replies Latest reply on May 31, 2006 4:05 AM by Heiko Braun

    Visual Studio 2005 interoperability problems

    Andrea Sansottera Newbie

      Hi all.

      I'm trying to develop a JAX-WS web service based on stateless session bean (EJB 3.0). I'm using the document/literal/wrapped style.

      The JBoss-generated WSDL is only partially ok with Visual Studio. In fact, with the JBoss WSDL, Visual Studio generates methods like this:
      createPersonResponse createPerson(createPerson createPerson1)
      Instead of the desired:
      int createPerson(String name)
      It does not "unwrapws" the parameters and return values.

      Deploying the same application on Glassfish generates a WSDL which is 100% ok with Visual Studio.

      I noticed that with manually-modifing WSDL, changing the following lines

       <message name='PeopleManagerWeb_personExistsResponse'>
       <part element='tns:personExistsResponse' name='result'/>
       </message>
      


      To:
       <message name='PeopleManagerWeb_personExistsResponse'>
       <part element='tns:personExistsResponse' name='parameters'/>
       </message>
      


      Solves the problem.

      I suppose that JBoss should adhere to this convention ('parameters' instead of 'result', even for output messages).

      Do you know any workaround for fixing this with annotations or configuration files?

      Andrea

        • 2. Re: Visual Studio 2005 interoperability problems
          Andreas Herbig Newbie

          Hi there.

          I have the same problem as Andrea explained (using: document/literal/wrapped). Is there any solution available yet? Or did you found a workaround or anything else? (Not changing the wsdl manually)

          And when I change the ParameterStyle to bare I'm getting a nullpointer exception. I read already something about it and found out that this appears by forgetting the @Oneway annotation for void methods. The problem is that i am not using void methods yet.


          @Stateless
          @WebService( name="EndpointInterface", targetNamespace="http://localhost:8080", serviceName="MaseSystemService")
          @PortComponent(contextRoot="/MaseSystemService", urlPattern="/webservice")
          @SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL, parameterStyle=SOAPBinding.ParameterStyle.BARE)
          
          public class MaseSystemServiceImpl implements MaseSystemService, Serializable {
           [...]
          
          
           @WebMethod
           public WsProject[] getAllProjects() throws RemoteException {
           [...]
           }
          
           @WebMethod
           public WsIteration[] getAllIterationsByProject(long id, boolean includingCompleted) throws RemoteException {
           [...]
           }
          }
          


          This Exception appears:


          14:25:21,889 ERROR [MainDeployer] Could not create deployment: file:/C:/JavaDev/jboss-4.0.4CR2/server/default/tmp/deploy/tmp10407ebe.ear-contents/ebe.jar
          java.lang.NullPointerException
           at org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils.write(WSSchemaUtils.java:429)
           at org.jboss.ws.metadata.wsdl.xmlschema.JBossXSNamespaceItem.toString(JBossXSNamespaceItem.java:377)
           at org.jboss.ws.metadata.wsdl.xmlschema.JBossXSModel.serializeNamespaceItems(JBossXSModel.java:535)
          [...]
          



          Thx and greets Andreas


          • 3. Re: Visual Studio 2005 interoperability problems
            Burr Sutter Master

            Related to Andreas problem.

            It seems that when returning a POJO (or array of POJOs) to .NET AND using @SOAPBinding(style = SOAPBinding.Style.DOCUMENT) you will see the problem.

            The workaround is to use RPC and .NET is happy, here is a modified example using a 181 Web Service, return an array of Person objects containing one Address objects (a weak example, I know but illustrates the point):

            package org.jboss.samples;
            
            import javax.jws.WebMethod;
            import javax.jws.WebService;
            import javax.jws.soap.SOAPBinding;
            import javax.jws.soap.SOAPBinding.Use;
            
            
            @WebService
            @SOAPBinding(style = SOAPBinding.Style.RPC)
            public class POJOService {
             @WebMethod(operationName="GetPersonByID")
             public Person getPerson(String id)
             {
             System.out.println("Actually just ignoring the id for " +
             " this example code: " + id);
             Person somebody = new Person();
             somebody.setName("Burr Sutter");
             somebody.setAge(24);
             somebody.setBirthDate(new java.util.Date());
             return somebody;
             }
            
             @WebMethod (operationName="GetAllPeopleArray")
             public Person[] getPeople() {
             Person[] results = new Person[2];
             Person a = new Person();
             a.setName("Burr Sutter");
             a.setAge(24);
             a.setBirthDate(new java.util.Date());
             Address anAddress1 = new Address();
             anAddress1.setStreetAddr1("123 ABC Lane");
             anAddress1.setStreetAddr1("Suite 200");
             anAddress1.setCity("Atlanta");
             a.setAddress(anAddress1);
             results[0] = a;
            
             Person b = new Person();
             b.setName("Thomas Diesler");
             b.setAge(23);
             b.setBirthDate(new java.util.Date());
             Address anAddress2 = new Address();
             anAddress2.setStreetAddr1("456 XYZ Street");
             anAddress2.setStreetAddr1("Box 221");
             anAddress2.setCity("New York");
             b.setAddress(anAddress2);
             results[1] = b;
            
             return results;
             }
            
             @WebMethod (operationName="AddPerson")
             public void addPerson(Person person) {
             System.out.println("\n\n");
             System.out.println(person.getName());
             System.out.println(person.getAddress().getStreetAddr1());
             System.out.println(person.getAge());
             }
            }
            
            


            The VB.NET WinForm code:
             Dim proxy As New JBossPOJO.POJOServiceService
            
             Dim results As JBossPOJO.Person() = proxy.GetAllPeopleArray
             For Each item As JBossPOJO.Person In results
             MsgBox(item.name & " " & item.address.streetAddr1)
             Next
            

            Note: JBossPOJO was created using Add Web Reference in the Solution Explorer of Visual Studio Express.

            The C# WebForm code:
             JBossPOJO.POJOServiceService proxy =
             new JBossPOJO.POJOServiceService();
             JBossPOJO.Person[] people = proxy.GetAllPeopleArray();
             StringBuilder x = new StringBuilder();
             foreach (JBossPOJO.Person aPerson in people)
             {
             x.Append(aPerson.name + " " +
             aPerson.address.streetAddr1 + "\n");
             }
             TextBox1.Text = x.ToString();
            
            


            Burr



            • 4. Re: Visual Studio 2005 interoperability problems
              Andreas Herbig Newbie

              Hi there. Thanks Burr.
              My webservice is now also available for C#.NET. I think the main problem was that we used Visual Studio 2003 for the client and not 2005...

              I am not sure but maybe it is the same problem which Andrea has, because the methods were created exactly in the same way as Andrea described when we used 2003. But now with using version 2005 and @SOAPBinding(style = SOAPBinding.Style.RPC) it works fine.

              By the way Burr. Your example shows everything what is needed so it can't be a weak example ;)

              Thanks and greets,
              Andreas

              Ps.: Why you didn't use the @Oneway annotation for the void method. As I said i read about it and thought that this appears a NullPointer. But I couldn't find the thread at the forum anymore :( I tried it out without this annotation and it still works fine... but I am still wondering.

              • 5. Re: Visual Studio 2005 interoperability problems
                Heiko Braun Master

                Would you like to share your experiences with other users? The WIKI would be a good starting point: http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWSAndDotNet