views:

30

answers:

0

I used myEclipse to generate a WebService Client for a webservice using the WSDL. The problem is that I have to add some security information, which is not present in the wsdl. I tried this:

public static void main(String[] args) {
    // TODO Auto-generated method stub
    ws.EVPQuery_Service s=new EVPQuery_Service();
    ws.EVPQuery e=s.getEVPQuery();
    ((BindingProvider)e).getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "testuser9");
    ((BindingProvider)e).getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "passw0rd");

    ws.EVPPersonQueryCriteria crit=new EVPPersonQueryCriteria();
    crit.setCnpNumber("");
    crit.setCountyCD("");
    try {
        ws.EVPPersonQueryResult res=e.queryPerson(crit);
    } catch (SableEVPQueryException_Exception e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
    System.out.println("Salut");
}

The problem is that it still gives me a error:

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Invalid username or password

How can I apply Username Token Policy?

Thank you!