Skip to main content

decoding a hexidecimal string message return

1 reply [Last post]
jmather
Offline
Joined: 2008-04-18

Hi,
Pretty new to java. I am receiving an array of string message from a ws and I get the following string message in return.

"org.hhcc.research.bold.ws.client.ArrayOfString@a37427".

the code that does this is :
respBase.setStrMessages(resp.getResp().getMessages().toString

I'm told i have to convert the hexidecimal in the return to a string the interpret the message (the message is suppose to give an explanation as to why the webservice won't accept the data I'm sending).
Can anyone help on decoding this message?

Thanks for any help here.

this is the entire code:
Private void updatePatPOVTbl(List respLst) throws Exception {
try {
Date respDt = new Date();

for (BoldSavePreOperativeVisitResp resp : respLst) {
TblBOLDWSPreOpVisit patPOV = em.find(TblBOLDWSPreOpVisit.class, resp.getPatId());
patPOV.setBitSentToBold(true);
em.persist(patPOV);

TblResponseBase respBase = new TblResponseBase();
respBase.setIntPID(resp.getPatId());
//respBase.setDteReservationExpires();
respBase.setStrAcknowledge(resp.getResp().getAcknowledge().value());
respBase.setStrBuild(resp.getResp().getBuild());
respBase.setStrCorrelationId(resp.getResp().getCorrelationId());
if (resp.getResp().getMessages() == null) {
respBase.setStrMessages("");
} else {
respBase.getTblResponseMessageCollection();
respBase.setStrMessages(resp.getResp().getMessages().toString());
}
respBase.setStrReservationID(resp.getResp().getReservationId());
respBase.setStrVersion(resp.getResp().getVersion());
respBase.setDteResponseDateTime(respDt);
respBase.setStrServiceType(BoldServiceContants.PREOPV);
em.persist(respBase);
}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ragnorok
Offline
Joined: 2008-04-28

- Shouldn't toString have parens: toString()?
- It looks to me like "resp.getResp().getMessages()" is returning an ArrayOfString object that should be traversed rather than calling toString() on it. The default behaviour of toString() is to return the class name and object address, and it looks like that's what happened.
- If respBase.setStrMessages() really does take a single string, try building one "from scratch" by traversing with a for:

String msgs="";
for(String amsg: resp.getResp().getMessages()) msg+=(!msg.equal("") ? "," : "")+amsg;
respBase.setStrMessages(msgs);

but I wouldn't be surprised if a method called "setStrMessages" (with an s) didn't take some collection as a parameter instead of a string.

- Hope this helps...