jeudi 19 juillet 2018

Building dynamic Proxy soap failed: Use BindingProvider.SOAPACTION_URI_PROPERTY to set it

I'm trying to consume a soap web service using dynamic proxy but i'm getting this error when i run it:

"javax.faces.el.EvaluationException: javax.xml.ws.WebServiceException: A valid SOAPAction should be set in the RequestContext when Addressing is enabled, Use BindingProvider.SOAPACTION_URI_PROPERTY to set it."

URL wsdURL = new URL(wsdl);
        Service service = Service.create(wsdURL, new QName(namespace,servicename));
        QName wsport = new QName(namespace, port);
        Dispatch<Source> disp = service.createDispatch(wsport, Source.class, Service.Mode.PAYLOAD,features);
        disp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, serviceUsername);
        disp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, servicePassword);

        Source wsCallResult = disp.invoke(new StreamSource(new StringReader(WSrequest)));
        String xmlResult = sourceToXMLString(wsCallResult);
        System.out.println("Resultado: "+xmlResult);

Can anyone help me to solve this, please?

Thanks.




Aucun commentaire:

Enregistrer un commentaire