Title: Message
WSDL2Java supports the generation of a simple JUnit test case. Object parameters are created using empty objects (new Object()).
 
Has someone extended this basic JUnit test to support objects with different states?
 
I don't want to programmatically set all field values in all tests. I found that to be somewhat dangerous (what if schema changes?) and quite tenuous when there is already some marshalling and schema mapping features inside the object. I don't want to create a new mapping logic.  
 
I've created a bunch of XML schema instances containing test data and I'd like to map those files to WSDL2Java generated objects. I've tried to use the Axis marshalling framework outside message generation but I can't find a way to get a TypeMappingRegistry with all serializers/deserializers registered. The actual registry is built in the first call, but I wasn't able to access it from my test class. I'm using the WSDL2Java generated stub.
 
I have tried various implementation of this function without success (using AxisServer instead of AxisClient, etc.) The registry is always empty (only default Axis mappings I guess).

public static DeserializationContext createSerializationContext(TypeDesc type, InputSource xmlSource, Service service)

{

DeserializationContext ctx = null;

AxisEngine engine = service.getEngine();

AxisEngine client = engine.getClientEngine();

TypeMappingRegistry tmr = client.getTypeMappingRegistry();

MessageContext msgctx = new MessageContext(client);

msgctx.setTypeMappingRegistry(tmr);

// Register all sub-types deserializer in this mapping

ctx = new DeserializationContextImpl(xmlSource, msgctx, org.apache.axis.Message.REQUEST);

return ctx;

}

 

After this, I'm parsing my XML file and call Deserializer.startElement() with all requested parameters. The parsing is failing because the type mapping isn't found.

Any help welcomed,

 

Joel

Reply via email to