12 Replies Latest reply on Jun 21, 2005 10:08 AM by philmcc

    message style web service using jbossws on jboss 4

    p_nevilleuk

      Does anyone have any advice on how to create message style web service using jbossws? I have done this on jboss 3.2.5, but can only see how to do RPC style on jboss 4.
      Can't see anything in www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd about this and have also looked at 'web services for j2ee spec version 1'.

      With jboss 3.2.5 I could update the web-service.zml like:






      Can't see any provision for this in webservices.xml


      Thanks in advance,
      Peter

        • 1. Re: message style web service using jbossws on jboss 4
          p_nevilleuk

          Sorry, should say:
          With jboss 3.2.5 I could update the web-service.xml like:

           <service name="MessageService" style="message">
           <parameter name="className" value="test.ejb.jbossdotnet.MessageService" />
           <parameter name="allowedMethods" value="echoElements" />
           </service>
          


          • 2. Re: message style web service using jbossws on jboss 4
            philmcc

            did you ever get this problem sorted out? i am trying to do the same thing!

            • 3. Re: message style web service using jbossws on jboss 4
              gunrock

              I am in the exact same position. I am interested in a document/message style WS (perhaps without the WSDL) and would like access to the message streams.

              Any ideas?

              • 4. Re: message style web service using jbossws on jboss 4
                philmcc

                i have found *some* instructions on this located here: http://wiki.jboss.org/wiki/Wiki.jsp?page=WSMessageEndpoints

                although i have tried to get this example working and can not. see if you have any better luck!

                phil

                • 5. Re: message style web service using jbossws on jboss 4
                  philmcc

                  i've just got it working - a jboss message style web service at last !!!

                  i'm going home from work now so will post some details tomorrow if anybody is interested.

                  • 6. Re: message style web service using jbossws on jboss 4
                    p_nevilleuk

                    Hi,
                    Just to let you know that I gave up trying to get this to work as I had to change app server to websphere.

                    What I do on websphere is simply use the SAAJ API, which suits me for SOAP/ebXML. It's a shame thought that J2EE doesn't support JAXM.


                    I would be interested in your jboss solution though for future reference if youget time.

                    Thanks

                    • 7. Re: message style web service using jbossws on jboss 4
                      jason.greene

                      Basically we are bound to the requirements of J2EE webservices, similar containers will have similar issues. There are 3 ways via JAXRPC that you can read a message in a DOM like fassion.

                      1. Message Endpoints - http://wiki.jboss.org/wiki/Wiki.jsp?page=WSMessageEndpoints

                      2. JAX-RPC Handlers (they allow you to do manipulation and processing of the request and response messages)

                      3. Modify your endpoint to implement ServiceLifeCycle, which will make the container pass you a ServletEndpointContext object on init. You can then use this context object to gain access to the request message using SAAJ.

                      The only other option you have, is to just wite a servlet, and use the SAAJ api to parse the request. Maybee future specifications will allow for more flexibility.

                      -Jason

                      • 8. Re: message style web service using jbossws on jboss 4
                        philmcc

                        I tried the message endpoint example you pointed to but this example is thin on detail. It isn?t as comprehensive as the tutorials on other message types. For example there is no jboss-web.xml, webservices.xml or web.xml file given.

                        I used a bit of common sense though (I think!) and put these files together with the details given there but initially couldn?t get it to work.

                        JBoss was throwing the following exception whenever the service was invoked:


                        javax.xml.rpc.JAXRPCException: org.w3c.dom.DOMException: INVALID_CHARACTER_ERR: An invalid or illegal XML character is specified.


                        After some time I found that if the service returned a org.w3c.dom.Document object it worked OK (i.e. instead of an Element object).

                        There is still one problem though, when the service is deployed, JBoss gives the following warnings, although it still deploys and works:


                        WARN [JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://ws.sample}in_part
                        WARN [JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://ws.sample}out_part
                        WARN [TypeMappingDescription] Class not found: com.myapp.in_part
                        WARN [TypeMappingDescription] Class not found: com.myapp.out_part
                        INFO [AxisService] WSDD published to: C:\Java\jboss-4.0.2\server\default\data\wsdl\message_endpoint.war\MessageEndpoint.wsdd
                        INFO [AxisService] Web Service deployed: http://mcp-con-1:8080/message_endpoint/messageEndpointService


                        It is like it is looking for serialiser / deserialiser classes to map my in/out types too but there is no mapping to be done here, right?

                        "in_part" and "out_part" are the types defined in my wsdl thus:

                        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://ws.sample">
                         <element name="in_part" type="xsd:anyType"/>
                         <element name="out_part" type="xsd:anyType"/>
                        </schema>
                        


                        Do you know how to stop these warning messages?

                        The WSDD created by JBoss looks like this:

                        <deployment
                         xmlns='http://xml.apache.org/axis/wsdd/'
                         xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
                         xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
                         xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
                         xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
                        
                        <service name='message_endpoint.war#MessageEndpoint' style='document' use='literal' provider='Handler'>
                        
                         <parameter name='webserviceID' value='message_endpoint.war#MessageEndpoint' />
                         <parameter name='handlerClass' value='org.jboss.webservice.server.InvokerProviderJSE' />
                        
                         <operation name='process' qname='ns1:process' returnQName='ns1:out_part' returnType='ns1:out_part' xmlns:ns1='http://ws.sample' >
                         <parameter name='in' qname='ns1:in_part' mode='IN' type='ns1:in_part' xmlns:ns1='http://ws.sample' />
                         </operation>
                        
                         <!-- Class not found, ignore type mapping
                         <typeMapping
                         qname='ns1:in_part' xmlns:ns1='http://ws.sample'
                         type='java:com.myapp.in_part'
                         serializer='null'
                         deserializer='null'
                         encodingStyle=''>
                         </typeMapping>
                         -->
                         <!-- Class not found, ignore type mapping
                         <typeMapping
                         qname='ns1:out_part' xmlns:ns1='http://ws.sample'
                         type='java:com.myapp.out_part'
                         serializer='null'
                         deserializer='null'
                         encodingStyle=''>
                         </typeMapping>
                         -->
                        </service>
                        </deployment>
                        


                        I would like to have something as simple as this as i think it would help fix the problem, how can I force the wsdd to be more like this:

                        <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:ns1="message-endpoint" >
                         <service name="message_endpoint.war#MessageEndpoint" style="message">
                         <parameter name="className" value="com.myapp.MessageEndpointService"/>
                         <parameter name="allowedMethods" value="process"/>
                         </service>
                        </deployment>
                        


                        I can't post my XML files if it helps.

                        Cheers, Phil.

                        • 9. Re: message style web service using jbossws on jboss 4
                          philmcc

                          ...sorry i meant to say "I CAN post my XML files"

                          • 10. Re: message style web service using jbossws on jboss 4
                            philmcc

                            ...i have given up trying to workout how to configure my jaxrpc-mapping.xml file to tell JBoss it's a message service and have decided to buy this book: JBoss 4.0: The Official Guide

                            Hopefully the answer will lie there!

                            • 11. Re: message style web service using jbossws on jboss 4
                              thomas.diesler

                              Have a look at

                              ant -Dtest=org.jboss.test.webservice.message.MessageTestCase one-test
                              


                              • 12. Re: message style web service using jbossws on jboss 4
                                philmcc

                                Thanks for that Thomas.

                                I couldn?t find the Ant target you gave me in the binary JBoss distribution so figured it was in the source.
                                I download the source, built it from JBOSS_HOME/build then ran the Ant target you gave me in JBOSS_HOME/testsuite

                                I found I had to add the following line into the testsuite build.xml file to get it to complete:

                                <pathelement path="${project.tools}/lib/ant-junit.jar"/>

                                ?just after this one on line 206:

                                <pathelement path="${project.tools}/lib/ant.jar"/>


                                I then ran your ant target on this build file in testsuite - it didn?t pass the JUnit test for some reason but I was able to find the necessary JBoss
                                message style web service xml files and service classes.

                                I war?d everthing and deployed it.

                                It deploys OK but still gives the following errors that I was getting with my message based service:

                                14:32:53,710 WARN [JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://org.jboss.test.webservice/message}Response
                                14:32:53,710 WARN [JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://org.jboss.test.webservice/message}Order
                                14:32:53,710 WARN [TypeMappingDescription] Class not found: org.jboss.test.webservice.message.Order
                                14:32:53,710 WARN [TypeMappingDescription] Class not found: org.jboss.test.webservice.message.Response


                                It works OK though. However when you undeploy it from the jmx-console using the MBean for the service under the jboss.web.deployment section,
                                then deploy it again - although it (the service) deploys and undeploys it no longer works when invoked by a client.

                                It throws the following exception:

                                java.lang.IllegalArgumentException: object is not an instance of declaring class


                                Is this something to do with the fact this service is not *properly* being deployed to Axis by JBoss as a message service although it will work like one?
                                (I feel it's not being properly deployed because of what i can see in the dynamically created WSDD file and WARN messages at the JBoss console
                                upon deployment)

                                Or is this to do with the casting of Elements to SOAPElements?

                                One other thing, the example client SOAP message given on the Message Endpoint tutorial Wiki (http://wiki.jboss.org/wiki/Wiki.jsp?page=WSMessageEndpoints)
                                seems to be wrong.
                                It looks like this:

                                <env:Envelope>
                                 <env:Body>
                                 <ns1:Order xmlns:ns1='http://ws.sample'>
                                 <Customer>Kermit</Customer>
                                 <Item>Ferrari</Item>
                                 </ns1:Order>
                                 </env:Body>
                                 </env:Envelope>


                                ?but I find that for the service to work the element immediately under the Body must have the same name as the exposed method. In this case processElement.