I get the above message when accessing java web service.
We originally created the Java Console application and manually sent the xml file. When running this as a Java application, a response is successfully created and displayed using System.out.println. We create a web service by selecting the java file containing these methods, and select "create webservice", specifying the dynamic project to be created by the web service and the methods to be shown.
What the application does is take the xml file and cancel it for the object using:
public static Object unmarshalToObject(Class classToBeBound,
String xmlRequest) {
Object obj = new Object();
try {
JAXBContext jc = JAXBContext.newInstance(classToBeBound);
Unmarshaller um = jc.createUnmarshaller();
obj = um.unmarshal(new StringReader(xmlRequest));
} catch (Exception e) {
e.printStackTrace()
}
return obj;
}
Some processing is done in a file, and then the object is sorted by xml as follows:
public static String marshalToXML(Object data) {
StringWriter sw = new StringWriter();
try {
logger.info("Create new Marshall");
JAXBContext jc = JAXBContext.newInstance("ContextPathName");
logger.info("Marshalled to xmlObjects");
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
marshaller.marshal(data, sw);
} catch (Exception e) {
logException(logger, e);
}
return sw.toString();
}
, , -, , :
JAXBContext jc = JAXBContext.newInstance("ContextPathName");
- SOAP:
<soapenv:Fault>
<faultcode>soapenv:Server.userException</faultcode>
<faultstring>java.lang.reflect.InvocationTargetException</faultstring>
<detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">servername</ns1:hostname>
</detail>
</soapenv:Fault>
Try/Catch , JAXBExceptions, , , , .
. sun\jwsdp-2.0\jaxb\lib:
jaxb-api.jar
jsr173_1.0_api.jar
jaxb-impl.jar
lib WEB-INF .
web- JBuilder 2008 R2 SOAPUI - wsdl, -.
- , , - , , !