0 Replies Latest reply on Jun 20, 2009 11:55 AM by Charles Akalugwu

    Problem creating SOAP Envelop (Android Client using Seam Web

    Charles Akalugwu Newbie

      Hi Guys,

      I am trying to connect to webservices in jboss(using seam) from a google android phone. So far, I implemented all the necessary beans and android classes. Unfortunately, I am getting an exception on the server side after the request is dispatched from the android emulator, java.lang.IllegalArgumentException: Cannot create SOAP envelope from: methodCall. I have tried everything I can but to no success. On the other hand, when I try to connect to the service from SOAP UI, everything works great. Please if you have any clue, help! Thanks a lot in advance.

      Interface

      
      package de.iu.soko.web.webservice;
      
      import javax.ejb.Remote;
      
      
      @Remote
      public interface SokoServiceRemote {
      
      
       public String hello();
      }
      



      Stateless Web Service Facade
      
      package de.iu.soko.web.webservice;
      
      import javax.ejb.Stateless;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.contexts.Contexts;
      import org.jboss.seam.security.Identity;
      
      @Stateless
      @WebService(name = "SokoService", serviceName = "SokoService")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      @Name("sokoServiceCallHandler")
      public class SokoService implements SokoServiceRemote {
      
       @Logger
       private Log log;
      
       @In(required=true)
       Identity identity;
      
      
      
       @WebMethod
       public String hello(){
      
       return "Hello from a seam component";
       }
      }
      
      




      standard-ws-config xml file
      
      <jaxws-config xmlns="urn:jboss:jaxws-config:2.0"
      
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:javaee="http://java.sun.com/xml/ns/javaee"
      
       xsi:schemaLocation="urn:jboss:jaxws-config:2.0 jaxws-config_2_0.xsd">
      
       <endpoint-config>
      
       <config-name>Seam WebService Endpoint</config-name>
      
       <pre-handler-chains>
      
       <javaee:handler-chain>
      
       <javaee:protocol-bindings>##SOAP11_HTTP
       </javaee:protocol-bindings>
      
       <javaee:handler>
      
       <javaee:handler-name>SOAP Request Handler</javaee:handler-name>
      
       <javaee:handler-class>org.jboss.seam.webservice.SOAPRequestHandler
       </javaee:handler-class>
      
       </javaee:handler>
      
       </javaee:handler-chain>
      
       </pre-handler-chains>
      
       </endpoint-config>
      
      </jaxws-config>
      
      





      entries in web.xml

      
      <filter>
       <filter-name>Seam Context Filter</filter-name>
       <filter-class>org.jboss.seam.web.ContextFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Context Filter</filter-name>
       <url-pattern>/test</url-pattern>
       </filter-mapping>
      
      
      
      <servlet-mapping>
       <servlet-name>AndroidService</servlet-name>
       <url-pattern>/androidService</url-pattern>
       </servlet-mapping>
       <servlet>
       <servlet-name>AndroidService</servlet-name>
       <servlet-class>de.iu.soko.web.webservice.SokoService</servlet-class>
       </servlet>
      






      SOAP UI request
      POST http://sylar:8080/soko-web/androidService?wsdl HTTP/1.1
      Content-Type: text/xml;charset=UTF-8
      SOAPAction: ""
      User-Agent: Jakarta Commons-HttpClient/3.1
      Host: sylar:8080
      Content-Length: 219
      
      <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.web.soko.iu.de/">
       <soapenv:Header/>
       <soapenv:Body>
       <web:hello/>
       </soapenv:Body>
      </soapenv:Envelope>
      
      





      SOAP UI Response
      <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Header>
       <seam:conversationId xmlns:seam="http://www.jboss.org/seam/webservice">21</seam:conversationId>
       </env:Header>
       <env:Body>
       <web:helloResponse xmlns:web="http://webservice.web.soko.iu.de/">
       <return>Hello from a seam component</return>
       </web:helloResponse>
       </env:Body>
      </env:Envelope>
      
      




      The Exception
      
      java.lang.IllegalArgumentException: Cannot create SOAP envelope from: methodCall
       at org.jboss.ws.core.soap.SOAPEnvelopeImpl.<init>(SOAPEnvelopeImpl.java:70)
       at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:124)
       at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:96)
       at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:262)
       at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:185)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:389)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:272)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:189)
       at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:122)
       at org.jboss.wsf.stack.jbws.EndpointServlet.service(EndpointServlet.java:84)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:595)