Hello,

I use the JBossWS-1.0GA with JBoss4.0.4CR2.

I tested the web service with EJB3 SessionBean, after use the wstools to 
generate the stub interfaces, it just rasied error in those generate codes.

I tried to use C# to call the WebService (M$VS2005), the code generation is 
better and correct than the wstools (provided with JBossWS), but it still not 
work and raised the exception: 


  | 10:23:06,421 ERROR [SOAPFaultExceptionHelper] SOAP request exception
  | javax.xml.rpc.JAXRPCException: Cannot create or send response message
  |         at 
org.jboss.ws.server.ServiceEndpoint.postProcessResponse(ServiceEndpoi
  | nt.java:311)
  |         at 
org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.jav
  | a:236)
  |         at 
org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServ
  | let.java:120)
  |         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  |         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  |         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
  | icationFilterChain.java:252)
  |         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
  | ilterChain.java:173)
  |         at 
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
  | lter.java:96)
  |         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
  | icationFilterChain.java:202)
  |         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
  | ilterChain.java:173)
  |         at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
  | alve.java:213)
  |         at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
  | alve.java:178)
  |         at 
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
  | ipalValve.java:54)
  |         at 
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
  | yAssociationValve.java:174)
  |         at 
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
  | e.java:74)
  |         at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
  | ava:126)
  |         at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
  | ava:105)
  |         at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
  | ve.java:107)
  |         at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
  | a:148)
  |         at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
  | :869)
  |         at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
  | rocessConnection(Http11BaseProtocol.java:664)
  |         at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
  | int.java:527)
  |         at 
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
  | kerThread.java:112)
  |         at java.lang.Thread.run(Thread.java:595)
  | Caused by: org.jboss.xb.binding.JBossXBValueFormatException: Java value for 
XSD
  | boolean type expected to be an instance of java.lang.Boolean or 
java.lang.Number
  | . But the value is of type org.hibernate.collection.PersistentBag
  |         at 
org.jboss.xb.binding.SimpleTypeBindings.marshal(SimpleTypeBindings.ja
  | va:1120)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalCharacters(XercesXsMar
  | shaller.java:1169)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalSimpleType(XercesXsMar
  | shaller.java:451)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementType(XercesXsMa
  | rshaller.java:405)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElement(XercesXsMarsha
  | ller.java:380)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementOccurence(Xerce
  | sXsMarshaller.java:886)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarsh
  | aller.java:823)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroupSequence(Xer
  | cesXsMarshaller.java:1102)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroup(XercesXsMar
  | shaller.java:1057)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarsh
  | aller.java:729)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalComplexType(XercesXsMa
  | rshaller.java:685)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementType(XercesXsMa
  | rshaller.java:414)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElement(XercesXsMarsha
  | ller.java:380)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementOccurence(Xerce
  | sXsMarshaller.java:886)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarsh
  | aller.java:823)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroupSequence(Xer
  | cesXsMarshaller.java:1102)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroup(XercesXsMar
  | shaller.java:1057)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarsh
  | aller.java:729)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalComplexType(XercesXsMa
  | rshaller.java:685)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementType(XercesXsMa
  | rshaller.java:414)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElement(XercesXsMarsha
  | ller.java:380)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementOccurence(Xerce
  | sXsMarshaller.java:886)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarsh
  | aller.java:810)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroupSequence(Xer
  | cesXsMarshaller.java:1102)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalModelGroup(XercesXsMar
  | shaller.java:1057)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalParticle(XercesXsMarsh
  | aller.java:729)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalComplexType(XercesXsMa
  | rshaller.java:685)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementType(XercesXsMa
  | rshaller.java:414)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElement(XercesXsMarsha
  | ller.java:380)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshalElementOccurence(Xerce
  | sXsMarshaller.java:886)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshallInternal(XercesXsMars
  | haller.java:275)
  |         at 
org.jboss.xb.binding.XercesXsMarshaller.marshal(XercesXsMarshaller.ja
  | va:222)
  |         at 
org.jboss.ws.jaxb.JAXBMarshallerImpl.marshal(JAXBMarshallerImpl.java:
  | 172)
  |         at 
org.jboss.ws.jaxrpc.encoding.JAXBSerializer.serialize(JAXBSerializer.
  | java:100)
  |         at 
org.jboss.ws.soap.SOAPContentElement.getXMLFragment(SOAPContentElemen
  | t.java:172)
  |         at 
org.jboss.ws.soap.SOAPContentElement.expandToDOM(SOAPContentElement.j
  | ava:844)
  |         at 
org.jboss.ws.soap.SOAPContentElement.getChildNodes(SOAPContentElement
  | .java:761)
  |         at org.jboss.util.xml.DOMWriter.printInternal(DOMWriter.java:201)
  |         at org.jboss.util.xml.DOMWriter.printInternal(DOMWriter.java:260)
  |         at org.jboss.util.xml.DOMWriter.printInternal(DOMWriter.java:260)
  |         at org.jboss.util.xml.DOMWriter.printInternal(DOMWriter.java:260)
  |         at org.jboss.util.xml.DOMWriter.print(DOMWriter.java:177)
  |         at org.jboss.util.xml.DOMWriter.printNode(DOMWriter.java:126)
  |         at 
org.jboss.ws.server.ServiceEndpoint.postProcessResponse(ServiceEndpoi
  | nt.java:305)
  |         ... 23 more
  | 
  | 



  | 
  | package mo.reales.ejb.session.impl;
  | 
  | import java.util.ArrayList;
  | import java.util.Collection;
  | 
  | import javax.ejb.Local;
  | import javax.ejb.Remote;
  | import javax.ejb.Stateless;
  | import javax.jws.WebMethod;
  | import javax.jws.WebService;
  | import javax.jws.soap.SOAPBinding;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | import javax.persistence.Query;
  | 
  | import mo.reales.ejb.model.ProductCategory;
  | import mo.reales.ejb.session.api.ProductCategoryLocal;
  | import mo.reales.ejb.session.api.ProductCategoryRemote;
  | 
  | import org.jboss.annotation.ejb.LocalBinding;
  | import org.jboss.annotation.ejb.RemoteBinding;
  | 
  | /**
  |  * ProductCategoryBean.java
  |  *
  |  * @author Chao Hoi Ka, Eric
  |  *
  |  */
  | @WebService(name = "CategoryInterface", targetNamespace = 
"http://eric.ws/reales";, serviceName = "CategoryService")
  | @SOAPBinding(style = SOAPBinding.Style.RPC)
  | @Stateless
  | @Local(ProductCategoryLocal.class)
  | @LocalBinding(jndiBinding="res_ProductCategorySessionBean/local")
  | @Remote(ProductCategoryRemote.class)
  | @RemoteBinding(jndiBinding="res_ProductCategorySessionBean/remote")
  | public class ProductCategoryBean implements ProductCategoryLocal, 
ProductCategoryRemote {
  |     @PersistenceContext(unitName="realesDatabase")
  |     protected EntityManager em;
  | 
  |     /**
  |      * 
  |      */
  |     public ProductCategoryBean() {
  |             super();
  |             // TODO Auto-generated constructor stub
  |     }
  | 
  |     /* (non-Javadoc)
  |      * @see mo.reales.ejb.session.ProductCategoryIF#addCategory(long, 
java.lang.String, java.lang.String)
  |      */
  |     @WebMethod
  |     public void addCategory(long id, String name, String description) {
  |             ProductCategory category = new ProductCategory();
  |             
  |             //category.setId(id);
  |             category.setName(name);
  |             category.setDescription(description);
  |             
  |             category = em.merge(category);
  |             
  |             em.persist(category);
  |     }
  | 
  |     
  |     
  |     
  |     /* (non-Javadoc)
  |      * @see mo.reales.ejb.session.ProductCategoryIF#deleteCategory(long)
  |      */
  |     @WebMethod
  |     public void deleteCategory(long id) {
  |             ProductCategory category = findById(id);
  |             
  |             deleteCategory(category);
  |     }
  | 
  |     /* (non-Javadoc)
  |      * @see 
mo.reales.ejb.session.ProductCategoryIF#deleteCategory(mo.reales.ejb.model.ProductCategory)
  |      */
  |     public void deleteCategory(ProductCategory category) {
  |             if (category != null) {
  |                     em.remove(category);
  |             }               
  |     }
  |     
  |     
  |     
  | 
  |     /* (non-Javadoc)
  |      * @see mo.reales.ejb.session.ProductCategoryIF#updateCategory(long, 
java.lang.String, java.lang.String)
  |      */
  |     @WebMethod
  |     public void updateCategory(long id, String name, String description) {
  |             ProductCategory category = findById(id);
  |             category.setName(name);
  |             category.setDescription(description);
  |             
  |             updateCategory(category);
  |     }
  | 
  |     /* (non-Javadoc)
  |      * @see 
mo.reales.ejb.session.ProductCategoryIF#updateCategory(mo.reales.ejb.model.ProductCategory)
  |      */
  |     public void updateCategory(ProductCategory category) {
  |             em.persist(category);
  |             
  |     }
  |     
  |     
  |     
  | 
  |     /* (non-Javadoc)
  |      * @see 
mo.reales.ejb.session.ProductCategoryIF#findByName(java.lang.String)
  |      */
  |     @WebMethod
  |     public ProductCategory findByName(String name) {
  |             Query query = em.createNamedQuery("productCategory.findByName");
  |             query.setParameter("name", name);
  |                             
  |             
  |             Object obj = query.getSingleResult();
  |             
  |             if (obj == null) {
  |                     return null;
  |             } else {
  |                     return (ProductCategory)obj;
  |             }
  |     }
  |     
  |     
  |     
  |     
  | 
  |     /* (non-Javadoc)
  |      * @see mo.reales.ejb.session.ProductCategoryIF#findById(long)
  |      */
  |     @WebMethod
  |     public ProductCategory findById(long id) {
  |             Object obj = em.find(ProductCategory.class, id);
  |             
  |             if (obj != null) {
  |                     return (ProductCategory)obj;
  |             } else {
  |                     return null;                    
  |             }
  |     }
  | 
  |     /* (non-Javadoc)
  |      * @see mo.reales.ejb.session.ProductCategoryIF#getCategories()
  |      */     
  |     public Collection<ProductCategory> getCategories() {
  |             //return em.createQuery("from ProductCategory 
p").getResultList();
  |             
  |             return 
em.createNamedQuery("productCategory.findAll").getResultList();          
  |     }
  |     
  |     @WebMethod
  |     public ProductCategory[] getCategoriesArray() {
  |             ArrayList categories = new ArrayList(); 
  |                             
  |             categories.addAll(getCategories());                             
  |             
  |             if (categories.size() > 0) {            
  |                     ProductCategory[] cats = new 
ProductCategory[categories.size()];
  |                     
  |                     cats = (ProductCategory[])categories.toArray(cats);     
                
  |                     
  |                     return cats;
  |             } else {
  |                     return null;
  |             }                                               
  |     }
  |     
  |     
  | 
  | }
  | 
  | 




Error with this generated class: The public type ProductCategory must be 
defined in its own file

  | 
  | /*
  |  * JBossWS WS-Tools Generated Source
  |  *
  |  * Generation Date: Fri May 12 10:32:09 GMT+08:00 2006
  |  *
  |  * This generated source code represents a derivative work of the input to
  |  * the generator that produced it. Consult the input for the copyright and
  |  * terms of use that apply to this source code.
  |  */
  | 
  | package eric.ws.reales;
  | 
  | 
  | 
  | 
  | public class  ProductCategory.Array
  | {
  | 
  | protected eric.ws.reales.ProductCategory[]  value;
  | public ProductCategory.Array(){}
  | 
  | public ProductCategory.Array(eric.ws.reales.ProductCategory[] value){
  | this.value=value;
  | }
  | public eric.ws.reales.ProductCategory[]  getValue() { return value ;}
  | 
  | public void setValue(eric.ws.reales.ProductCategory[] value){ 
this.value=value; }
  | 
  | }
  | 
  | 



  | <definitions name='CategoryService' targetNamespace='http://eric.ws/reales' 
xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://util.java/jaws' 
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' 
xmlns:tns='http://eric.ws/reales' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
  |  <types>
  |   <schema elementFormDefault='qualified' 
targetNamespace='http://eric.ws/reales' 
xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns2='http://util.java/jaws' 
xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' 
xmlns:tns='http://eric.ws/reales' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  |    <import namespace='http://util.java/jaws'/>
  |    <complexType name='ProductCategory'>
  |     <sequence>
  |      <element name='description' nillable='true' type='string'/>
  |      <element name='id' type='long'/>
  |      <element name='name' nillable='true' type='string'/>
  |      <element name='products' nillable='true' type='ns2:Collection'/>
  |     </sequence>
  |    </complexType>
  |    <complexType name='ProductCategory.Array'>
  |     <sequence>
  |      <element maxOccurs='unbounded' minOccurs='0' name='value' 
nillable='true' type='tns:ProductCategory'/>
  |     </sequence>
  |    </complexType>
  |   </schema>
  |   <schema elementFormDefault='qualified' 
targetNamespace='http://util.java/jaws' 
xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns1='http://eric.ws/reales' 
xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' 
xmlns:tns='http://util.java/jaws' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
  |    <import namespace='http://eric.ws/reales'/>
  |    <complexType name='Collection'>
  |     <sequence>
  |      <element name='empty' type='boolean'/>
  |     </sequence>
  |    </complexType>
  |   </schema>
  |  </types>
  |  <message name='CategoryInterface_addCategoryResponse'></message>
  |  <message name='CategoryInterface_getCategoriesArray'></message>
  |  <message name='CategoryInterface_findByNameResponse'>
  |   <part name='result' type='tns:ProductCategory'/>
  |  </message>
  |  <message name='CategoryInterface_findById'>
  |   <part name='long_1' type='xsd:long'/>
  |  </message>
  |  <message name='CategoryInterface_addCategory'>
  |   <part name='long_1' type='xsd:long'/>
  |   <part name='String_1' type='xsd:string'/>
  |   <part name='String_2' type='xsd:string'/>
  |  </message>
  |  <message name='CategoryInterface_updateCategoryResponse'></message>
  |  <message name='CategoryInterface_deleteCategory'>
  |   <part name='long_1' type='xsd:long'/>
  |  </message>
  |  <message name='CategoryInterface_updateCategory'>
  |   <part name='long_1' type='xsd:long'/>
  |   <part name='String_1' type='xsd:string'/>
  |   <part name='String_2' type='xsd:string'/>
  |  </message>
  |  <message name='CategoryInterface_deleteCategoryResponse'></message>
  |  <message name='CategoryInterface_getCategoriesArrayResponse'>
  |   <part name='result' type='tns:ProductCategory.Array'/>
  |  </message>
  |  <message name='CategoryInterface_findByName'>
  |   <part name='String_1' type='xsd:string'/>
  |  </message>
  |  <message name='CategoryInterface_findByIdResponse'>
  |   <part name='result' type='tns:ProductCategory'/>
  |  </message>
  |  <portType name='CategoryInterface'>
  |   <operation name='addCategory' parameterOrder='long_1 String_1 String_2'>
  |    <input message='tns:CategoryInterface_addCategory'/>
  |    <output message='tns:CategoryInterface_addCategoryResponse'/>
  |   </operation>
  |   <operation name='deleteCategory' parameterOrder='long_1'>
  |    <input message='tns:CategoryInterface_deleteCategory'/>
  |    <output message='tns:CategoryInterface_deleteCategoryResponse'/>
  |   </operation>
  |   <operation name='findById' parameterOrder='long_1'>
  |    <input message='tns:CategoryInterface_findById'/>
  |    <output message='tns:CategoryInterface_findByIdResponse'/>
  |   </operation>
  |   <operation name='findByName' parameterOrder='String_1'>
  |    <input message='tns:CategoryInterface_findByName'/>
  |    <output message='tns:CategoryInterface_findByNameResponse'/>
  |   </operation>
  |   <operation name='getCategoriesArray'>
  |    <input message='tns:CategoryInterface_getCategoriesArray'/>
  |    <output message='tns:CategoryInterface_getCategoriesArrayResponse'/>
  |   </operation>
  |   <operation name='updateCategory' parameterOrder='long_1 String_1 
String_2'>
  |    <input message='tns:CategoryInterface_updateCategory'/>
  |    <output message='tns:CategoryInterface_updateCategoryResponse'/>
  |   </operation>
  |  </portType>
  |  <binding name='CategoryInterfaceBinding' type='tns:CategoryInterface'>
  |   <soap:binding style='rpc' 
transport='http://schemas.xmlsoap.org/soap/http'/>
  |   <operation name='addCategory'>
  |    <soap:operation soapAction=''/>
  |    <input>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </input>
  |    <output>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </output>
  |   </operation>
  |   <operation name='deleteCategory'>
  |    <soap:operation soapAction=''/>
  |    <input>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </input>
  |    <output>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </output>
  |   </operation>
  |   <operation name='findById'>
  |    <soap:operation soapAction=''/>
  |    <input>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </input>
  |    <output>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </output>
  |   </operation>
  |   <operation name='findByName'>
  |    <soap:operation soapAction=''/>
  |    <input>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </input>
  |    <output>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </output>
  |   </operation>
  |   <operation name='getCategoriesArray'>
  |    <soap:operation soapAction=''/>
  |    <input>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </input>
  |    <output>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </output>
  |   </operation>
  |   <operation name='updateCategory'>
  |    <soap:operation soapAction=''/>
  |    <input>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </input>
  |    <output>
  |     <soap:body namespace='http://eric.ws/reales' use='literal'/>
  |    </output>
  |   </operation>
  |  </binding>
  |  <service name='CategoryService'>
  |   <port binding='tns:CategoryInterfaceBinding' name='CategoryInterfacePort'>
  |    <soap:address 
location='http://DINF25HKC:80/reales-ejb/ProductCategoryBean'/>
  |   </port>
  |  </service>
  | </definitions>
  | 



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3943097#3943097

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3943097


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to