Friday, February 07, 2014

Continue: How the CastorMarshaller Mapping Look Like

I choose CastorMarshaller over Jaxb2Marshaller because I love what the mapping.xml gives me. It is powerful and flexible even though annotation is very cool.

I also choose not to generate the famous ObjectFactory and POJO from WSDL. Partially because I have to access a rather poor written WSDL. These generated classes bear names of non-sense and confusion. Also partially because I only need to access 20% of the web services. To bundle two sets of web services in one endpoint while knowing each set is designed for different purpose and different consumer is never a practice that I will consider in any near future.

Here is the mapping file. Note I can have any class name mapping to any soap name. And these Java classes are completely POJO.



According to CastorMarshaller documentation, ns-uri as attribute of the map-to definition promises the namespace declaration. For example, ns-prefix="myPrefix" and ns-uri="myServices" would create a SOAP request of myprefix:soaprequestname xmlns:myprefix="myServices", however, it only creates myprefix:soaprequestname xmlns:myprefix="null". For this, I don't understand why.

No comments: