View Single Post
  #6  
Old 13th September 2017, 21:53
lfhaddix lfhaddix is offline
Junior Member
 
Join Date: Apr 2012
Posts: 4
lfhaddix is on a distinguished road
Baan: ERP LN - DB: db2 - OS: aix
I have gotten as far as sending the AddScan successfully but now I am trying to add Error handling. jax-ws shows that it is returning a AddScanResponseType but when I look at the actual logs, it is returning a Result. How do I get access to the <Result> object so that I can check messages?

<code>
public String addScan(String poNumber, String login, String userId) {
StringBuffer responseMsg = new StringBuffer("");
System.out.println("AddScan order:"+poNumber +" login:"+login +" user: "+userId);
List<InformationMessage> responseMessages = null;
String message = "Scan not attempted";
try {
String serverName = BarcodeUtil.getLN_Server(BarcodeConstants.COMPANY_NUMBER); // 09-07-17
String c4wsServerName = BarcodeUtil.getC4WS_Server( ); // 09-07-17
String url = String.format(BarcodeConstants.C4WS_FORMAT, c4wsServerName, serverName); // 09-07-17
System.out.println(url);
URL newWsdlLocation = new URL(url);
AssemblyLineScansService service = new AssemblyLineScansService(newWsdlLocation);
AssemblyLineScans serviceReq = service.getAssemblyLineScansSoapPort();
ObjectFactory factory = new ObjectFactory();
AddScanRequestType params = factory.createAddScanRequestType();
ControlArea controlArea = factory.createAddScanRequestTypeControlArea();
params.setControlArea(controlArea);
DataArea dataArea = factory.createAddScanRequestTypeDataArea();
infor.erpln.c4ws.web.wsdl.client.AddScanRequestType.DataArea.AssemblyLineScans scan = new infor.erpln.c4ws.web.wsdl.client.AddScanRequestType.DataArea.AssemblyLineScans( );
scan.setOrder(poNumber);
scan.setLogin(login);
scan.setUser(userId);
dataArea.getAssemblyLineScans().add(scan);
params.setDataArea(dataArea);
AddScanResponseType response = serviceReq.addScan( params );
if (response == null) {
System.out.println("response is null" );
} else {
if ((response.getInformationArea() == null) || (response.getInformationArea().getMessage() == null)) {
System.out.println("InformationArea or Message is null" );
message = "";
} else {
responseMessages = response.getInformationArea().getMessage();
InformationMessage tempMsg = null;
for (int m = 0; m < responseMessages.size(); m++) {
tempMsg = (InformationMessage)responseMessages.get(m);
message = tempMsg.getMessageText();
System.out.println(tempMsg.getMessageText());
break;
}
}

}
} catch (Exception ex) {
message = ex.getMessage();
ex.printStackTrace();
}
return message;
}


</code>

<code>
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (270): JCA Daemon starts -trace
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (273): Bshell Name='ftvbaant2.bb.local', BSE Release='6.2', Bshell pid=13435030, Process pid=1
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (273): BSE directory='/new_test_a01/app/bse'
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2411): Enter: handleInitDsEvent()
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2659): Enter: handleInitRequest(clientProtocolVersion: 3, company: 150)
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2672): switch.to.company() returned: 1
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2686): Leave: handleInitRequest() return value: 1, serverProtocolVersion: 3, productname: ERP LN, productversion: 8.4, username: lfhaddix
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2432): Leave: handleInitDsEvent()
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2447): Enter: handleBdeOpenDsEvent()
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2470): Leave: handleBdeOpenDsEvent()
[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (105): BDE Manager starts
[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (108): Bshell Name='ftvbaant2.bb.local', BSE Release='6.2', Bshell pid=13435030, Process pid=3
[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (108): BSE directory='/new_test_a01/app/bse'
[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (342): Enter: handleDsBdeRequest()
[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (469): handleBdeRequest for: AssemblyLineScans, invoke: AddScan, request:
[14:12:46]lfhaddix: ottstpbdeman (3) {150}, pttstpbdeman0 (488) :
<?xml version="1.0"?>
<AddScanRequest>
<ControlArea/>
<DataArea>
<AssemblyLineScans>
<order>P2200000FC1071212</order>
<login>fc1op080</login>
<user>P2200000001704</user>
</AssemblyLineScans>
</DataArea>
</AddScanRequest>
[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (509): handleBdeRequest returns: -12
[14:12:46]lfhaddix: ottstpbdeman (3) {150}, pttstpbdeman0 (522) :
<?xml version="1.0"?>
<Result>
<messageCode>tlbcts0074</messageCode>
<messageType>Error</messageType>
<messageText>Request validation; Attr. &apos;order&apos;, Value &apos;P2200000FC1071212&apos;: the value is too long.</messageText>
<messageSource>Application</messageSource>
</Result>

[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (365): Leave: handleDsBdeRequest()
[14:12:46]lfhaddix: ottstpbdeman (3), pttstpbdeman0 (747): handleCloseRequest()
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (2624): Enter: handleConnectorClose()
[14:12:46]lfhaddix: ottstpjcadaemon (1), pttstpjcadaemon0 (1005): doExit JCA Daemon

</code>
Reply With Quote