7 Replies Latest reply on Nov 19, 2007 4:32 AM by ropalka

    webParameter is null

    florian79

      The call to the webservice works fine but the parameter are null (or 0 in case of int).

      I use a AJAX- Client and send directly the xml.

      the Bean:

      @WebService(
       endpointInterface="com.dooris.ws.TheServicePortType",
       targetNamespace="http://www.tai.it/TheService",
       serviceName="TheService",
       portName="TheServiceSOAP"
      )
      @Stateless
      public class TheServiceImpl implements TheServiceSessionBean
      {
       public final String getHalloWorld()
       {
       return "Hallo Welt ";
       }
      
       public final String sayHallo(int iNameGot)
       {
       return "Hallo " + iNameGot;
       }
      }
      


      the call (xml):

      <?xml version='1.0' encoding='utf-8'?><soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'><soap:Body><sayHallo xmlns='http://www.tai.it/TheService'><arg0>5567</arg0></sayHallo></soap:Body></soap:Envelope>



      and the response (xml)
      Status:200
      RESULT:<env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns2:sayHalloResponse xmlns:ns2="http://www.tai.it/TheService"><return>Hallo 0</return></ns2:sayHalloResponse></env:Body></env:Envelope>


      where is my mistake?

        • 1. Re: webParameter is null
          florian79

          the generated WSDL:

          <definitions name='TheService' targetNamespace='http://www.tai.it/TheService' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://www.tai.it/TheService' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
           <types>
           <xs:schema targetNamespace='http://www.tai.it/TheService' version='1.0' xmlns:tns='http://www.tai.it/TheService' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
           <xs:element name='getHalloWorld' type='tns:getHalloWorld'/>
           <xs:element name='getHalloWorldResponse' type='tns:getHalloWorldResponse'/>
           <xs:element name='sayHallo' type='tns:sayHallo'/>
           <xs:element name='sayHalloResponse' type='tns:sayHalloResponse'/>
           <xs:complexType name='getHalloWorld'/>
           <xs:complexType name='getHalloWorldResponse'>
          
           <xs:sequence>
           <xs:element minOccurs='0' name='return' type='xs:string'/>
           </xs:sequence>
           </xs:complexType>
           <xs:complexType name='sayHallo'>
           <xs:sequence>
           <xs:element name='arg0' type='xs:int'/>
           </xs:sequence>
           </xs:complexType>
          
           <xs:complexType name='sayHalloResponse'>
           <xs:sequence>
           <xs:element minOccurs='0' name='return' type='xs:string'/>
           </xs:sequence>
           </xs:complexType>
           </xs:schema>
           </types>
           <message name='TheServicePortType_getHalloWorldResponse'>
           <part element='tns:getHalloWorldResponse' name='getHalloWorldResponse'></part>
          
           </message>
           <message name='TheServicePortType_sayHalloResponse'>
           <part element='tns:sayHalloResponse' name='sayHalloResponse'></part>
           </message>
           <message name='TheServicePortType_sayHallo'>
           <part element='tns:sayHallo' name='sayHallo'></part>
           </message>
           <message name='TheServicePortType_getHalloWorld'>
           <part element='tns:getHalloWorld' name='getHalloWorld'></part>
          
           </message>
           <portType name='TheServicePortType'>
           <operation name='getHalloWorld' parameterOrder='getHalloWorld'>
           <input message='tns:TheServicePortType_getHalloWorld'></input>
           <output message='tns:TheServicePortType_getHalloWorldResponse'></output>
           </operation>
           <operation name='sayHallo' parameterOrder='sayHallo'>
           <input message='tns:TheServicePortType_sayHallo'></input>
           <output message='tns:TheServicePortType_sayHalloResponse'></output>
          
           </operation>
           </portType>
           <binding name='TheServicePortTypeBinding' type='tns:TheServicePortType'>
           <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
           <operation name='getHalloWorld'>
           <soap:operation soapAction=''/>
           <input>
           <soap:body use='literal'/>
           </input>
          
           <output>
           <soap:body use='literal'/>
           </output>
           </operation>
           <operation name='sayHallo'>
           <soap:operation soapAction=''/>
           <input>
           <soap:body use='literal'/>
           </input>
          
           <output>
           <soap:body use='literal'/>
           </output>
           </operation>
           </binding>
           <service name='TheService'>
           <port binding='tns:TheServicePortTypeBinding' name='TheServiceSOAP'>
           <soap:address location='http://192.168.1.22:8080/TheServiceImplService/TheServiceImpl'/>
           </port>
          
           </service>
          </definitions>


          • 2. Re: webParameter is null
            florian79

            I have the same problem in jbosws 1.2 and 2.0

            is there any mistake in my request?

            really no idea?!

            • 3. Re: webParameter is null
              georges.goebel

              Hi,

              I have exactly the same proble with JBOSS 4.2.0 and 4.2.2.

              @Stateless(name = "Facade")
              @Local(Facade.class)
              @Remote(Facade.class)
              @WebService
              public class FacadeImpl implements Facade {
               @WebMethod
               public List<NiveauService> getLastDataNiveauService(String e1, String e2) throws WebPchException {
               System.out.println(e1);
               System.out.println(e2);
               }
              
              }
              


              When I invoke the Webservice from the generated wsdl by a client written in Java with Axis1 or Axis2 or JAXWS2 the parameters e1 and e2 have the correct values.

              When I invoke the Webservice from SOAP Client (under MACOS X) or by a PHP client, both parameters e1 and e2 are null !

              What could be the solution to this problem ?

              Thanks

              • 4. Re: webParameter is null
                georges.goebel

                Hi,

                I have found one solution get it working. I have to use the annotation @SOAPBinding(style = SOAPBinding.Style.RPC)

                @Stateless(name = "Facade")
                @Local(Facade.class)
                @Remote(Facade.class)
                @WebService
                @SOAPBinding(style = SOAPBinding.Style.RPC)
                public class FacadeImpl implements Facade {
                 @WebMethod
                 public NiveauService[] getLastDataNiveauService(String e1, String e2) throws WebPchException {
                 System.out.println(e1);
                 System.out.println(e2);
                 }
                
                }
                


                But I read everywhere that RPV is "BAD" and "Document" should be used instead. But when I use Document I have the previous error.
                Can somebody tell me if it is worth to implement a RPC solution, or how can I get it working with "Document" ?

                thanks

                • 5. Re: webParameter is null
                  georges.goebel

                   

                  "georges.goebel" wrote:
                  Hi,

                  I have exactly the same proble with JBOSS 4.2.0 and 4.2.2.

                  @Stateless(name = "Facade")
                  @Local(Facade.class)
                  @Remote(Facade.class)
                  @WebService
                  public class FacadeImpl implements Facade {
                   @WebMethod
                   public List<NiveauService> getLastDataNiveauService(String e1, String e2) throws WebPchException {
                   System.out.println(e1);
                   System.out.println(e2);
                   .....
                   }
                  
                  }
                  


                  When I invoke the Webservice from the generated wsdl by a client written in Java with Axis1 or Axis2 or JAXWS2 the parameters e1 and e2 have the correct values.

                  When I invoke the Webservice from SOAP Client (under MACOS X) or by a PHP client, both parameters e1 and e2 are null !

                  What could be the solution to this problem ?

                  Thanks


                  • 6. Re: webParameter is null
                    asoldano

                    I think the request message you're sending is not valid if you use the Document / Literal style, while it is good for RPC/Lit. RPC/encoded is definitely bad, rpc/lit can be used instead. Anyway, if you need/want to use doc/lit, I would suggest to copy from a soap request created by another ws stack (jbossws itself, axis or tools like soapui, etc.)

                    • 7. Re: webParameter is null
                      ropalka

                      Also ensure you're sending SOAPAction HTTP header if applicable.

                      Richard