I created a web service in netbeans from wsdl. for a complex type a custom java class (JAXB) was created, I need to pass this value to an oracle type in a procedure This is my code
public static Clob select (HeaderReq hdReq, String utility, String barcode,String client) throws SQLException {
String query = "{? = Call ws.select (?,?,?,?)}";
callableStatement = conn.getInstance (). getCon (). prepareCall (query);
callableStatement.registerOutParameter (1, OracleTypes.CLOB);
callableStatement.setObject (2, hdReq);
callableStatement.setString (3, utility);
callableStatement.setString (4, barcode);
callableStatement.setString (5, client);
callableStatement.executeQuery ();
return callableStatement.getClob (1);
} catch (SQLException ex) {
System.out.println (ex);
}
return null;
}
hdReq throws me a column type error and I try this but it did not work
JAXBContext context = JAXBContext.newInstance (HeaderReq.class);
Marshaller m = context.createMarshaller ();
m.setProperty (Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); // To format XML
StringWriter sw = new StringWriter ();
m.marshal (hdReq, sw);
xmlString = sw.toString ();
callableStatement.setObject (2, xmlString);