1

I am using JBoss AS 7.1.1 and JAX-WS 2.0.

In my application, I need to pass a Map<String, Map<String, String>> to a service. I made a custom complex type which extends TreeMap. While debugging, I confirmed that the object I was trying to sent was filled with data, but the received object was empty. From other posts, it seems this is because does not play well with SOAP serialization. Is there some way I can implement SOAP XML serialization for my object without changing types, making a ton of fields, etc? I want to be able to the following:

public String doSoapXmlSerialization() {
    // code
}
public void doSoapXmlDeserialization() {
    // code
}

It would be a very simple matter for me to write serialization and deserialization methods. I can also imagine writing some kind of XSD file to allow the SOAP methods to do my work for me. I have not been able to find any guides for this. By what mechanism does JAX-WS try to serialize objects?.

Ethan Reesor
  • 2,090
  • 1
  • 23
  • 40
  • Does your custom type implement serializable? It has to to go over the network. – Logan Jun 07 '12 at 04:02
  • My type extends TreeMap, which implements serializable. – Ethan Reesor Jun 07 '12 at 16:04
  • Does your service have a wsdl? If so, run the jboss wsconsume program on the wsdl stored as a file to see what it generates as java code for it. In jboss 5 this was in the jboss bin folder. It will take a wsdl file and generate java code to call the wsdl. You should be able to pass this kind of data. I've passed a map object as input, but it was a mapmessage for jms. Maybe look at hoe MapMessage is written for ideas. – Logan Jun 08 '12 at 15:24

1 Answers1

0

I realized that the section (of my WSDL file) describing the send and receive objects was an XML Schema, and that SOAP uses JAXB. I followed this guide and built a schema. This allowed me to create whatever I wanted.

Related:

JAXB: how to marshall map into <key>value</key>

Community
  • 1
  • 1
Ethan Reesor
  • 2,090
  • 1
  • 23
  • 40