9 Replies Latest reply on Sep 4, 2006 9:41 AM by Thomas Diesler

    Problem with User defined object in Jboss web service

    zohar sheinberg Newbie

      Hi,

      When I call a ws method - test1() - that gets a user defined object from a .Net client I get an exception on the client side:

      "Cannot find child element: MyClass_1"} Hi,

      When I call a ws method - test1() - that gets a user defined object from a .Net client I get an exception on the client side:

      "Cannot find child element: MyClass_1"} System.Web.Services.Protocols.SoapException {System.Web.Services.Protocols.SoapHeaderException}

      I use jboss 4.0.4GA + Java 1.5.0_06-b05

      Any ideas ?
      Thanka

      *Here are my classes:

      public interface TestInterface extends Remote {
      public String test1 (String a, MyClass b) throws RemoteException;
      }
      -------------------------------------------------------------------------

      @Stateless
      @WebService
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class TestFacade implements TestFacadeInterface {

      @WebMethod
      public String test1 (String a, MyClass b) throws RemoteException{
      return a;
      }
      }

      -------------------------------------------------------------------------------

      public class MyClass implements Serializable{
      String a;

      public String getA() {
      return a;
      }
      public void setA(String a) {
      this.a = a;
      }
      }

        • 1. Re: Problem with User defined object in Jboss web service
          zohar sheinberg Newbie

          Anyone can help ? I really need this one.
          Thanks.

          • 2. Re: Problem with User defined object in Jboss web service
            Steve Newbie

            I remember reading somewhere that .net likes methods that start with capitals... it might be a convention or otherwise. Try setting the operation name on you webmethod annotation to include operationName="Test1".

            No claims that this will work but give it a try.

            Steve.

            • 3. Re: Problem with User defined object in Jboss web service
              zohar sheinberg Newbie

              Hi Steve,
              I tried your solution but it did not help.
              Thanks anyway.

              Zohar

              • 4. Re: Problem with User defined object in Jboss web service
                Steve Newbie

                Hi Zohar,
                Did you have copies of the generated wsdl and the soap message being sent to the server.

                Steve.

                • 5. Re: Problem with User defined object in Jboss web service
                  zohar sheinberg Newbie

                  Sorry, But I still had a problem posting the WSDL. This time it should work:

                  1. This is the WSDL that is generated by the .Net client:

                  <?xml version="1.0" encoding="utf-8"?>
                  <definitions xmlns:tns="http://org/jaws" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="TestFacadeService" targetNamespace="http://org/jaws" xmlns="http://schemas.xmlsoap.org/wsdl/">
                   <types>
                   <xsd:schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://org/jaws">
                   <xsd:complexType name="MyClass">
                   <xsd:sequence>
                   <xsd:element name="a" nillable="true" type="xsd:string" />
                   </xsd:sequence>
                   </xsd:complexType>
                   </xsd:schema>
                   </types>
                   <message name="TestFacade_Test1">
                   <part name="String_1" type="xsd:string" />
                   <part name="MyClass_1" type="tns:MyClass" />
                   </message>
                   <message name="TestFacade_Test1Response">
                   <part name="result" type="xsd:string" />
                   </message>
                   <portType name="TestFacade">
                   <operation name="Test1" parameterOrder="String_1 MyClass_1">
                   <input message="tns:TestFacade_Test1" />
                   <output message="tns:TestFacade_Test1Response" />
                   </operation>
                   </portType>
                   <binding name="TestFacadeBinding" type="tns:TestFacade">
                   <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" />
                   <operation name="Test1">
                   <soap:operation soapAction="" />
                   <input>
                   <soap:body use="literal" namespace="http://org/jaws" />
                   </input>
                   <output>
                   <soap:body use="literal" namespace="http://org/jaws" />
                   </output>
                   </operation>
                   </binding>
                   <service name="TestFacadeService">
                   <port name="TestFacadePort" binding="tns:TestFacadeBinding">
                   <soap:address location="http://TLVD60154031A:8080/TestFacade/TestFacade" />
                   </port>
                   </service>
                  </definitions>



                  2. This is the WSDL that I get when I acces
                  http://localhost:8080/TestFacade/TestFacade?wsdl:

                  <definitions name='TestFacadeService' targetNamespace='http://org/jaws' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org/jaws' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
                   <types>
                   <schema elementFormDefault='qualified' targetNamespace='http://org/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://org/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
                   <complexType name='MyClass'>
                   <sequence>
                   <element name='a' nillable='true' type='string'/>
                   </sequence>
                   </complexType>
                   </schema>
                   </types>
                   <message name='TestFacade_Test1'>
                   <part name='String_1' type='xsd:string'/>
                   <part name='MyClass_1' type='tns:MyClass'/>
                   </message>
                   <message name='TestFacade_Test1Response'>
                   <part name='result' type='xsd:string'/>
                   </message>
                   <portType name='TestFacade'>
                   <operation name='Test1' parameterOrder='String_1 MyClass_1'>
                   <input message='tns:TestFacade_Test1'/>
                   <output message='tns:TestFacade_Test1Response'/>
                   </operation>
                   </portType>
                   <binding name='TestFacadeBinding' type='tns:TestFacade'>
                   <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
                   <operation name='Test1'>
                   <soap:operation soapAction=''/>
                   <input>
                   <soap:body namespace='http://org/jaws' use='literal'/>
                   </input>
                   <output>
                   <soap:body namespace='http://org/jaws' use='literal'/>
                   </output>
                   </operation>
                   </binding>
                   <service name='TestFacadeService'>
                   <port binding='tns:TestFacadeBinding' name='TestFacadePort'>
                   <soap:address location='http://TLVD60154031A:8080/TestFacade/TestFacade'/>
                   </port>
                   </service>
                  </definitions>



                  3. I used a sniffer and this is what I got when I called test1()
                  from my .Net client:

                  POST /TestFacade/TestFacade HTTP/1.1
                  
                  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.42)
                  
                  Content-Type: text/xml; charset=utf-8
                  
                  SOAPAction: ""
                  
                  Host: tlvd60154031a:8080
                  
                  Content-Length: 316
                  
                  Expect: 100-continue
                  
                  Connection: Keep-Alive
                  
                  HTTP/1.1 100 Continue
                  
                  <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><Test1 xmlns="http://org/jaws"><String_1 xmlns="">1</String_1></Test1></soap:Body></soap:Envelope>
                  HTTP/1.1 500 Internal Server Error
                  
                  Server: Apache-Coyote/1.1
                  
                  X-Powered-By: Servlet 2.4; JBoss-4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)/Tomcat-5.5
                  
                  Set-Cookie: JSESSIONID=00C7A2C43F19677B78910277825F9BDD; Path=/
                  
                  Content-Type: text/xml;charset=UTF-8
                  
                  Transfer-Encoding: chunked
                  
                  Date: Mon, 28 Aug 2006 12:27:41 GMT
                  
                  Connection: close
                  
                  51
                  
                  <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header/>
                  
                  2a
                  
                  <env:Body><env:Fault>env:Client
                  
                  c
                  
                  
                  
                  31
                  
                  Cannot find child element: MyClass_1
                  
                  e
                  
                  
                  
                  c
                  
                  </env:Fault>
                  
                  b
                  
                  </env:Body>
                  
                  f
                  
                  </env:Envelope>
                  
                  0
                  


                  Regards,
                  Zohar

                  • 6. Re: Problem with User defined object in Jboss web service
                    Steve Newbie

                    Hi Zohar,
                    You have posted the reply from the server, but do you have the original soap message from teh client to the server.

                    I have a feeling that the server is not understanding the request that your client is providing, ie potentially the wrong name spaces etc. I had a similar problem with a php client talking to my server, as it was puting the child element (in your case my_class1) in the wrong namespace.

                    If stand up an instance of axis's tcpmon, it will proxy all of your soap messages for you and let you examine the requests and responses, it will also let you manipulate the messages and resend them.

                    Steve.

                    • 7. Re: Problem with User defined object in Jboss web service
                      zohar sheinberg Newbie

                      Hi Steve,

                      I used a simple filter for getting the client request. The request:

                      <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><Test1 xmlns="http://org/jaws"><String_1 xmlns="">This is the input string</String_1><MyClass_1 xmlns=""><a xmlns="http://org/jaws">This is the a member value of the input MyClass</a></MyClass_1></Test1></soap:Body></soap:Envelope>


                      Zohar

                      • 8. Re: Problem with User defined object in Jboss web service
                        Steve Newbie

                        Zohar,
                        I set up an instance of the ejb you posted, a few minor tweaks with target namespace and operation name so the generated wsdl would match the one you posted, and sent the request you posted to my web service using xmlspy and it worked fine.

                        I am running jbossws 1.0.2GA, but i wouldnt think that would make any difference.

                        Steve.

                        • 9. Re: Problem with User defined object in Jboss web service
                          Thomas Diesler Master

                          Whatever client you use, it must share the same abstract contract (i.e. the server generated WSDL).
                          It does not make sense to talk about a server side WSDL *and* a client side WSDL.

                          Having said that, I know that .NET has issues or does not support rpc/literal. Try document/literal.