• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JAXB Marshal issue? Program TERMINATES, No exception thrown!

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
have created java classes from XMLs/schemas using JAXB. Am trying to marshal an instance of the generated class. Program TERMINATES.
Using WSAD. JAXB. on XP

Am sending the sysouts and the bit of code. any help would be of great use.

Thanks in advance.
Sachin.

Sysouts starts:
...
...
THE SERVICE TYPE IS : HotelSearchService
com.xxco.as.mr.sfrf.ctn.partner.common.PartnerServiceLocator : invokePartnerHotelSearchService(Object req) : ENTER
MY classname=com.xxco.as.mr.sfrf.ctn.partner.hotel.hilton.HiltonHotelSearchRequest
factory=com.xxco.ctn.sfrf.simulator.OTA_HotelSearchRQ.ObjectFactory@1c316abb
simReq=com.xxco.ctn.sfrf.simulator.OTA_HotelSearchRQ.impl.OTAHotelSearchRQImpl@ac2eabb
prePOS
postPOS
is this null=com.xxco.ctn.sfrf.simulator.OTA_HotelSearchRQ.impl.POSTypeImpl@8b12abb
Converted Request RB: com.xxco.ctn.sfrf.simulator.OTA_HotelSearchRQ.impl.OTAHotelSearchRQImpl@ac2eabb
trying to marshall



thats it! nothing more! WSAD remains stable. no spurt in memory usage. no looping seems to occur.

CODE:

...
...
if (otaHotelSearchRQ != null) {
System.out.println("Converted Request RB: " + otaHotelSearchRQ);
} else {
System.out.println(
"Null RQ Object Received At HotelSearchServiceLocator");
return null;
}

Object responseObj = null;

try {
//convert sim RQ to xml
JAXBContext jContextRQ =
JAXBContext.newInstance(
"com.xxco.ctn.sfrf.simulator.OTA_HotelSearchRQ"); //Partner RQ qualified class name
Marshaller marshaller = jContextRQ.createMarshaller();
StringWriter writer = new StringWriter();
System.out.println("trying to marshall");
marshaller.marshal(otaHotelSearchRQ, writer);
System.out.println("done marshall");
String requestXml = writer.toString();
System.out.println("Converted Request to String. making call");


//call partner service
SimulatorClient simulatorClient = new SimulatorClient();
String response = simulatorClient.processRequest(requestXml);

System.out.println("got response" + response);

//convert xml to sim RS
JAXBContext jContext =
JAXBContext.newInstance(
"com.xxco.ctn.sfrf.simulator.OTA_HotelSearchRS"); //Partner RQ qualified class name
Unmarshaller unMarshaller = jContext.createUnmarshaller();

OTAHotelSearchRS otaHotelsearchRS =
(OTAHotelSearchRS) unMarshaller.unmarshal(
new InputSource(new StringReader(response)));
if (otaHotelsearchRS == null) {
System.out.println(
"Null RS Object Received At HotelSearchServiceLocator");
}

System.out.println("Converted String to response");

//copy from sim RS to sfrf RS
responseObj = new SimHotelSearchRSBuilder().getPartnerRS(otaHotelsearchRS);

} catch (Throwable e) {
e.printStackTrace();
}
...
...
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not familiar with JAxB but I would try these -
See if 'marshaller' is null?
Check the StringWriter. I would try writing this to a file or something else if yoou have another API that supports such a construct to see if the marshall() method is returning anything or not.

Thanks.

- m
reply
    Bookmark Topic Watch Topic
  • New Topic