0

嗨,我正在从我的网络服务创建客户端。客户端已成功生成,但是当我从 java 代码中调用它时,它会引发以下错误:

Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://ebs-uat.corp.chartercom.com/csg_cter/2.06/orderdetailservice.asmx?wsdl. It failed with: 
Server returned HTTP response code: 401 for URL: https://ebs-uat.corp.chartercom.com/csg_cter/2.06/orderdetailservice.asmx?wsdl.
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:151)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:133)
at com.sun.xml.internal.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:254)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:217)
at com.sun.xml.internal.ws.client.WSServiceDelegate.<init>(WSServiceDelegate.java:165)
at com.sun.xml.internal.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:93)
at javax.xml.ws.Service.<init>(Service.java:56)
at com.charter.enterprise.billing.csg.orderdetails.OrderDetailServicePort.<init>(OrderDetailServicePort.java:68)
at com.charter.enterprise.billing.csg.orderdetails.OrderDetailServiceClient.main(OrderDetailServiceClient.java:18)

Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://ebs-uat.corp.chartercom.com/csg_cter/2.06/orderdetailservice.asmx?wsdl
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at java.net.URL.openStream(URL.java:1010)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.createReader(RuntimeWSDLParser.java:793)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.resolveWSDL(RuntimeWSDLParser.java:251)
at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:118)
... 7 more

创建 web 服务端口时在第一行抛出异常

DataServicePort dataServicePort = new DataServicePort();

我完整的客户课程是:

public class OrderDetailServiceClient {
    @WebServiceRef
    private static OrderDetailServicePort orderDetailServicePort;
    private static OrderDetailService orderDetailService;

    public static void main(String[] args) {
        orderDetailServicePort = new OrderDetailServicePort();
        orderDetailService = orderDetailServicePort.getOrderDetailService();
        // Add your code to call the desired methods.

        System.out.println("Before calling method!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
        verifyOrderDetail();
    }

    private static void verifyOrderDetail() {
        BindingProvider prov = (BindingProvider) orderDetailService;
        prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY,
            "CHTR\tst_aopebstest");
        prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY,
            "T$t_@0p3B$t#sT");
        orderDetailService = (OrderDetailService) prov;

        VerifyOrderDetailRequest verifyOrderDetailRequest = new VerifyOrderDetailRequest();

        VerifyOrderDetailResponse verifyOrderDetailResponse = orderDetailService
            .verifyOrderDetail(verifyOrderDetailRequest, null);

    }
}

我可以在我的浏览器中点击。它也在 SoapUI 中工作。我哪里错了?任何建议将不胜感激。提前致谢。

4

1 回答 1

0

您似乎无法访问该 Web 服务,您是否尝试过通过 Web 浏览器访问该 Web 服务?

于 2013-05-11T10:59:37.723 回答