Java – jax-ws error: unable to create SOAP message due to exception: XML reader error: wstxunexpected charexception: unexpected character ‘[‘

It shows the following errors. I don't understand why. Can someone help me?

The error is:

The function of my call is:

private static ContractTermsDownloadReply contractTermsDownloadOperation(
        ContractTermsDownloadRequest body) {
    ContractTermsDownload service = null;
    try {
        URI uri = new URI("https://companyname.com/ContractTermsDownload");
        service = new ContractTermsDownload(uri.toURL());
    } catch (Exception ex) {
        Logger.getLogger(JavaApplication1.class.getName()).log(
                Level.SEVERE,null,ex);
    }

    ariba.sourcing.vrealm_1461.ContractTermsDownloadPortType port = service
            .getContractTermsDownloadPortType();
    BindingProvider prov = (BindingProvider) port;
    prov.getRequestContext().put("authorization","Basic User2011:Password2011");

    try {
        ContractTermsDownloadReply reply = port
                .contractTermsDownloadOperation(body);
        return reply;
    } catch (Exception exc) {
        System.out.println(exc.getMessage());
    }
    return null;
}

Solution

If you are using basic auth, the credentials are usually Base64 encoded Pay attention to this line, including the syntax:

prov.getRequestContext().put("authorization","Basic User2011:Password2011");
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>