我想使用apache cxf使客户端(java)请求webservice。
web服务:
https://extenavigator.ukho.gov.uk/serviceB2B/submitUKHOOrdering.svc https://extenavigator.ukho.gov.uk/ServiceB2B/SubmitUKHOOrdering.svc?singleWsdl
我使用wsdl2java生成java代码,
它不起作用:
JaxWsProxyFactoryBean proxyFactory = new JaxWsProxyFactoryBean();
proxyFactory.setServiceClass(IOrderingService.class);
proxyFactory.setAddress("https://extenavigator.ukho.gov.uk/serviceB2B/submitUKHOOrdering.svc");
proxyFactory.setUsername(USERNAME);
proxyFactory.setPassword(PASSWORD);
proxyFactory.setBindingId("http://www.w3.org/2003/05/soap/bindings/HTTP/");
IOrderingService client = (IOrderingService) proxyFactory.create();
System.out.println("submit order...");
SubmitOrderResponse submitOrderResponse = client.submitOrder(WebService.makeSubmitOrderRequest());
System.out.println("submit order response...");
Integer orderId = submitOrderResponse.getOrderId();
System.out.println("orderId:" + orderId);
submitOrderResponse.getOrderStatus().getValue().getOrderItemStatus().forEach(item -> {
System.out.println("item.getProduct:" + item.getProduct());
System.out.println("item.getStatus:" + item.getStatus());
});
System.out.println("AccountId:" + submitOrderResponse.getAccountId());
抛出
java.net.SocketTimeoutException:读取超时
我尝试建立一个c#客户端来请求服务,
它正在运作!
uk.OrderingServiceClient client = new uk.OrderingServiceClient();
if (client.ClientCredentials != null)
{
client.ClientCredentials.UserName.UserName = "XXXXXX";
client.ClientCredentials.UserName.Password = "XXXXXX";
}
client.Endpoint.Address = new EndpointAddress("https://extenavigator.ukho.gov.uk/serviceB2B/submitUKHOOrdering.svc");
var response = client.SubmitOrder(new SubmitOrderRequest()
{
Order = new Order()
{
DistId = 2960,
LicenceId = 45039,
DeliveryMethod = DeliveryMethod.Both,
OrderItems = new OrderItem[]{
new OrderItem()
{
ProductId = "AR201130",
ProductPeriod = 9,
ProductType = ProductType.AVCSCharts
}
}
},
RequestId = Guid.NewGuid().ToString()
});
任何解决方案(java客户端)?
答案 0 :(得分:0)
此代码正在运行:
sparse-checkout