将XML字符串作为参数传递给Java中的Soap webservice

时间:2015-12-05 09:35:44

标签: java xml

这是xml String:

xmlStr="<Survey><abc>123</abc></survey>"

我想将该xml字符串转换为以下类对象:

JAXBContext jaxbContext = JAXBContext.newInstance(org.tempuri.camswrapper.service_lt.GetSurveyResult.Xmldoc.class);
            org.tempuri.camswrapper.service_lt.ServiceLT service = new org.tempuri.camswrapper.service_lt.ServiceLT();
            org.tempuri.camswrapper.service_lt.ServiceLTSoap port = service.getServiceLTSoap12();
    Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();

            org.tempuri.camswrapper.service_lt.GetSurveyResult.Xmldoc  xmldoc = (org.tempuri.camswrapper.service_lt.GetSurveyResult.XmlDoc) jaxbUnmarshaller.unmarshal(inputSource);

将org.tempuri.camswrapper.service_lt.GetSurveyResult.XmlDoc此类对象传递给以下方法:

String result=port.getSurveyResult(xmldoc);

0 个答案:

没有答案