こんにちは、Web サービスからクライアントを作成しています。クライアントは正常に生成されますが、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 でも動作しています。どこが間違っていますか?任意の提案をいただければ幸いです。前もって感謝します。