I am deploying a webservice to jboss 5.1.0 and the object model (input to the webmethod) is a complex object, while the scalar properties are being converted to XML payload correctly, the complex properties are all null. My object model is as follow:
DecisionInput has several integer and string properties, Customer object and Account objects. The Customer and Account objects are always null when it get to the actually method.
After deploying the webservice, I ran JBOSS_HOME/bin/wsconsume.bat to generate the proxy and a set of classes. My client code used the generated classes to create the object model to send to the webservice.
I was wondering if I need to do any configuration for the mapping of objects to help the object's XML-marshling process.
Sure, I have attached the wsdl on the original message since I cann't attach in the reply message.
By complex object I meant a hierarchical of objects. For example: Company has 1 or more Department which has one or more Employee which has an Address. In this example, Address is a simple object which only contains scalars and string.
Ahh found the problem. You're using xs:any which is always an issue with jaxb and needs to be handled.
When creating an item, you'll need to use the ObjectFactory.create..... which returns a JAXBElement<sometype>
When accessing, you'll have to type cast the object to a JAXBElement<sometype>
you'll probably also want to use a tool like tcpmon to verify the content on the wire against the wsdl/xsd and make adjustments (if necessary) to the object factory
All methods have the same problem.
Thanks for looking at the issue but the wsdl is generated by jboss and I got it via http://127.0.0.1:8080/rules/AdamRuleServiceBeanService?wsdl&resource=AdamRuleServiceBusiness_PortType2782554796338800358.wsdl. So, I don't think I can change the type, can I?
Also I am using the ws client object model (generated by wsconsume.bat) to create items to be sent to the webmethod; so my code does not involve JAXB at all. Is there any way to configure (mapping file or annotation) the JAXB to do that for me?
it's your service, you can do whatever you want.
Start with the attached wsdl
modify as necessary and try to remove the xs:any's
you'll also need to add the service and port definitions
use wsconsume -k (wsdlfile)
take the generated output and add it to a jar or war project
located the interface class, AdamRuleServiceBusiness
create another class that implements AdamRuleServiceBusiness
fill in your logic, build and deploy
My deploy.jar does not acually contain the wsdl. It only contains the AdamRuleServiceBusiness.class and the AdamRuleServiceBean that implements the business class. When I deploy the ear file, the wsdl file dynamically is generated. The one I attached in the original message is actually the included resource, the master wsdl is at the end of this message. It has the service and the port defitions and the import element.
I'll try to follow your suggestion but can you tell me where to put the wsdl file in the ear file?
<definitions name='AdamRuleServiceBeanService' targetNamespace='http://package.name.in.reverse.order' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://qdadamruleservice/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://package.name.in.reverse.order' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<import location='http://127.0.0.1:8080/rules/AdamRuleServiceBeanService?wsdl&resource=AdamRuleServiceBusiness_PortType4532169396188034069.wsdl' namespace='http://qdadamruleservice/'></import>
<port binding='ns1:AdamRuleServiceBusinessBinding' name='AdamRuleServiceBeanPort'>
The wsdl isn't needed on the service side, the web service stack typically generates it for you through reflection. Only the client needs the wsdl for runtime bindings. Search for my other posts on service chaining, there's an example somewhere with a netbeans project and instructions for running it in jboss and how to recreate it from scratch. It may be useful