简体   繁体   English

使用JSP消耗Webservice JAX

[英]Consume Webservice JAX with JSP

Hello i have a little question, well i am new on webservice and i am trying to consume a webservice which returns an xml structure, but i only want the String result, this is the method for take the result 您好,我有一个小问题,好吧,我是web服务的新手,我正尝试使用返回xml结构的web服务,但是我只想要String结果,这是获取结果的方法

public JAXBElement<ResultLogin> getResultLogin() {
        return resultLogin;
    }

i return it on String parsing it with toString(); 我在用toString();解析它的String上返回它toString(); but only returns a strange code not the true result. 但只会返回一个奇怪的代码,而不是真实的结果。

Any tips? 有小费吗? or tutorials or something? 还是教程之类的? Ty

I guess the problem is that you are invoking the toString() method on the JAXBElement object returned. 我猜问题是您正在对返回的JAXBElement对象调用toString()方法。 Instead, what you need to do is to get the value out of the JAXBElement, cast it to a ResultLogin object and invoke toString() on it: 相反,您需要做的是从JAXBElement中获取值,将其转换为ResultLogin对象并在其上调用toString()

((ResultLogin) getResultLogin().getValue()).toString();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM