ERROR "do not have a Property of the name Return"

Asked

Viewed 151 times

1

Hello, I’m trying to implement a Webservice and I’m having trouble answering. I used Soapui and it’s working. I am at the stage of implementing the Webservice client in the application. When I request, the reply error appears "[class] of not have a Property of the name Return"

Follows the code:

public static void main(String[] args) {
    XmlDoc doc = null;

    try {
        List<String> documento = Files.readAllLines(Paths.get("C:\\Users\\Ceser\\Desktop\\teste.xml"));

        WebService1 service = new WebService1();
        WebService1Soap soap = service.getWebService1Soap();

        soap.inserirPedido(2, (XmlDoc) documento);

    } catch (IOException e) {
        e.printStackTrace();
    }
 }

Requisition:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "iTipo", "xmlDoc" })
@XmlRootElement(name = "inserirPedido")
public class InserirPedido {

protected int iTipo;
protected InserirPedido.XmlDoc xmlDoc;

public int getITipo() {
    return iTipo;
}

public void setITipo(int value) {
    this.iTipo = value;
}

public InserirPedido.XmlDoc getXmlDoc() {
    return xmlDoc;
}

public void setXmlDoc(InserirPedido.XmlDoc value) {
    this.xmlDoc = value;
}

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "content" })
public static class XmlDoc {

    @XmlMixed
    @XmlAnyElement(lax = true)
    protected List<Object> content;

    public List<Object> getContent() {
        if (content == null) {
            content = new ArrayList<Object>();
        }
        return this.content;
    }

}

}

Answer:

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "inserirPedidoResponse")
public class InserirPedidoResponse {



}

EXCEPTION:

Exception in thread "main" javax.xml.Ws.Webserviceexception: class br.com.Caelum.estoquews.client.Inserpedidoresponse do not have a Property of the name Return at com.sun.xml.internal.Ws.client.sei.Responsebuilder$Doclit.(Unknown Source) at com.sun.xml.internal.Ws.client.sei.StubHandler.buildResponseBuilder(Unknown Source) at com.sun.xml.internal.Ws.client.sei.StubHandler.(Unknown Source) at com.sun.xml.internal.Ws.db.Databindingimpl.initStubHandlers(Unknown Source) at com.sun.xml.internal.Ws.db.Databindingimpl.(Unknown Source) at com.sun.xml.internal.Ws.db.Databindingproviderimpl.create(Unknown Source) at com.sun.xml.internal.Ws.db.Databindingproviderimpl.create(Unknown Source) at com.sun.xml.internal.Ws.db.Databindingfactoryimpl.createRuntime(Unknown Source) at com.sun.xml.internal.Ws.client.Wsservicedelegate.buildRuntimeModel(Unknown Source) at com.sun.xml.internal.Ws.client.Wsservicedelegate.createSEIPortInfo(Unknown Source) at com.sun.xml.internal.Ws.client.Wsservicedelegate.addSEI(Unknown Source) at com.sun.xml.internal.Ws.client.Wsservicedelegate.getPort(Unknown Source) at com.sun.xml.internal.Ws.client.Wsservicedelegate.getPort(Unknown Source) at com.sun.xml.internal.Ws.client.Wsservicedelegate.getPort(Unknown Source) at javax.xml.Ws.Service.getPort(Unknown Source) at br.com.Caelum.estoquews.client.Webservice1.getWebService1Soap(Webservice1.java:72) at br.com.Caelum.estoquews.client.TesteWebService.main(Testewebservice.java:23) Caused by: javax.xml.bind.Jaxbexception: Return is not a Valid Property on class br.com.Caelum.estoquews.client.Insertieresponse at com.sun.xml.internal.bind.v2.runtime.Jaxbcontextimpl.getElementPropertyAccessor(Unknown Source) at com.sun.xml.internal.Ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessor(Unknown Source) ... 17 more

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.