-
1. Re: JBoss 5.1: Complex objects are not being convert to XML payload
spyhunter99 Apr 12, 2012 7:35 PM (in response to tdnhome)can you share the wsdl?
what do you mean by complex obect?
-
2. Re: JBoss 5.1: Complex objects are not being convert to XML payload
tdnhome Apr 12, 2012 7:59 PM (in response to spyhunter99)Hi spyhunter,
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.
Thanks,
-Trung
-
3. Re: JBoss 5.1: Complex objects are not being convert to XML payload
spyhunter99 Apr 12, 2012 8:27 PM (in response to tdnhome)Gotcha, there's no service element in the wsdl so I just ginned up one. which method is having the issue?
-
4. Re: JBoss 5.1: Complex objects are not being convert to XML payload
spyhunter99 Apr 12, 2012 8:32 PM (in response to spyhunter99)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
-
5. Re: JBoss 5.1: Complex objects are not being convert to XML payload
tdnhome Apr 12, 2012 9:28 PM (in response to spyhunter99)Hi spyhunter,
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?
Thanks,
-Trung
-
6. Re: JBoss 5.1: Complex objects are not being convert to XML payload
spyhunter99 Apr 12, 2012 9:34 PM (in response to tdnhome)1 of 1 people found this helpfulit'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
-
7. Re: JBoss 5.1: Complex objects are not being convert to XML payload
tdnhome Apr 13, 2012 2:56 AM (in response to spyhunter99)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?
Thanks,
-Trung
<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>
<service name='AdamRuleServiceBeanService'>
<port binding='ns1:AdamRuleServiceBusinessBinding' name='AdamRuleServiceBeanPort'>
<soap:address location='http://127.0.0.1:8080/rules/AdamRuleServiceBeanService'/>
</port>
</service>
</definitions> -
8. Re: JBoss 5.1: Complex objects are not being convert to XML payload
spyhunter99 Apr 13, 2012 7:30 AM (in response to tdnhome)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
-
9. Re: JBoss 5.1: Complex objects are not being convert to XML payload
tdnhome Apr 13, 2012 1:00 PM (in response to spyhunter99)Hi spyhunter,
It all makes sense to me now. I'll follow your suggestion and let you know the results.
Thanks,
-Trung