5 Replies Latest reply on Jun 14, 2006 12:37 PM by Kerry Barnes

    can anyone help me?

    Adam Newbie

      I have got the question - how to invoke the web service - ( jsr181 ejb3 as endpoint from examples) from standalone client? I tried everything from docs but nothing works. Problem is: i have added one method which param is simple class with two properties and always i have exception:

      Exception in thread "main" org.jboss.ws.WSException: Cannot obtain java type mapping for: {http://org.mazurek.ws/jsr181ejb}Param

      My client code:

       ServiceFactory factory = ServiceFactory.newInstance();
       URL wsdlLocation = new URL("http://localhost:8080/jsr181ejb/EJB3Bean?wsdl");
       QName serviceName = new QName("http://org.mazurek.ws/jsr181ejb", "MyService");
       ServiceImpl service = (ServiceImpl)factory.createService(wsdlLocation, serviceName);
       Call call = service.createCall();
       QName operationName = new QName("http://org.mazurek.ws/jsr181ejb", "echo");
       String hello = "Hello";
       String world = "world!";
       Object retObj = call.invoke(new Object[]{hello});

      <definitions name="MyService" targetNamespace="http://org.mazurek.ws/jsr181ejb" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://org.mazurek.ws/jsr181ejb" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <schema elementFormDefault="qualified" targetNamespace="http://org.mazurek.ws/jsr181ejb" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://org.mazurek.ws/jsr181ejb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <complexType name="Param">
       <element name="firstName" nillable="true" type="string"/>
       <element name="lastName" nillable="true" type="string"/>
       <message name="EndpointInterface_echo">
       <part name="String_1" type="xsd:string"/>
       <message name="EndpointInterface_numOfBooksByAuthor">
       <part name="Param_1" type="tns:Param"/>
       <message name="EndpointInterface_numOfBooksByAuthorResponse">
       <part name="result" type="xsd:long"/>
       <message name="EndpointInterface_echoResponse">
       <part name="result" type="xsd:string"/>
       <portType name="EndpointInterface">
       <operation name="echo" parameterOrder="String_1">
       <input message="tns:EndpointInterface_echo"/>
       <output message="tns:EndpointInterface_echoResponse"/>
       <operation name="numOfBooksByAuthor" parameterOrder="Param_1">
       <input message="tns:EndpointInterface_numOfBooksByAuthor"/>
       <output message="tns:EndpointInterface_numOfBooksByAuthorResponse"/>
       <binding name="EndpointInterfaceBinding" type="tns:EndpointInterface">
       <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
       <operation name="echo">
       <soap:operation soapAction=""/>
       <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>
       <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>
       <operation name="numOfBooksByAuthor">
       <soap:operation soapAction=""/>
       <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>
       <soap:body namespace="http://org.mazurek.ws/jsr181ejb" use="literal"/>
       <service name="MyService">
       <port binding="tns:EndpointInterfaceBinding" name="EndpointInterfacePort">
       <soap:address location="http://adam:8080/jsr181ejb/EJB3Bean"/>

      I the examples are clients in jar files - for what are them?
      I hope someone will help me....


        • 1. Re: can anyone help me?
          John DeStefano Apprentice


          I have the same issue with my annotated ejb's. I have seen this problem in other posts on the forum but no solution. Using simple types a parameters and returns causes no problems. For me, I have tries to use an array of a value type as a return parameter and the issue stated above happens. My service is deployed a doc/lit bare.

          Any help would be appreciated.


          • 2. Re: can anyone help me?
            John DeStefano Apprentice


            Also, if anyone has an example of a jsr181 annotated ejb with a webmethod that returns a value type and uses a jsr109 client could they post it.


            • 3. Re: can anyone help me?
              Chris Baxter Newbie

              Did you create and deploy a client jar file for your webservice? That is the suggested approach to communicating with a J2EE webservice from a java application. Your client jar will contain the WSDL, jaxrpc-mapping.xml, jboss-client.xml and application-client.xml files (all in the META-INF folder). The lookup code becomes much easier as you simply lookup the Service object itself from JNDI. For more on how to create the client jar, check out this link:


              Client apps are the same for JSR109 and JSR181 endpoints, so don't let the fact that the documentation says it's for JSR109 throw you off.

              • 4. Re: can anyone help me?
                Thomas Diesler Master

                Please remember that with web services the client and the server
                are fundamentally disconnected. There are server side issues
                and client side issues - DO NOT MIX the two.

                In other words, if you setup an ejb3 endpoint using jsr181 any client
                that adhers to the abstract contract in wsdl can talk to that endpoint.

                If you want to implement a WS client using JBossWS (to what server
                impl it talks to does not matter) you use wstools to generate the
                WS4EE required artifacts from wsdl. The artifacts are

                - Service Endpoint Interface (SEI)
                - [User Types]
                - [User Exceptions]
                - jaxrpc-mapping.xml

                The standard JAXRPC ServiceFactory does not have an API that
                takes jaxrpc-mapping.xml into account. That is a flaw in the spec that
                has been fixed with JSR109 preconfigured stubs that can be obtained
                from JNDI in a J2EE-1.4 compliant appserver. Alternatively you use
                the JBossWS propriatary API to point to the
                CLIENT SIDE REQUIRED jaxrpc-mapping.xml.

                Please make sure, you understand J2EE application clilents i.e. the
                benefit of runing your client app on a tiny jboss instance.


                Most folks that have issues with WS clients do not understand the
                WS4EE client side programming model or don't realize that jaxrpc-mapping.xml is needed to bridge the gap between
                wsdl and java.

                Other stacks do java reflection (i.e. guesswork that ignors the
                abstract contract) or have another propriatary way to bridge that gap.

                • 5. Re: can anyone help me?
                  Kerry Barnes Newbie

                  For ws4ee this may work, but we are using the 4.0.4-GA release and it does not deploy the ws4ee stack, and because of a problem with it I can not use it anyway.

                  That being said can anyone point me to a good example or description on how to use the JbossWS in 4.0.4-GA from within an EJB3 Session Bean?