且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WSDL太大时,JAX-WS客户端将挂起30秒

更新时间:2023-09-11 22:28:22

今天您很幸运!有两种选择:

Today you're in luck! There is two options:

  1. 在本地使用WSDL文档文件

    将WSDL文档文件和方案文件的副本保存到您的项目中.

  1. Use a WSDL document file locally

    Save a copy of the WSDL document file and the schemma files to your project.

ClassLoader classloader = Thread.currentThread().getContextClassLoader();
URL wsdlLocation = classloader.getResource("MyHelloService.wsdl");
QName serviceName= new QName("http://test.com/", "MyHelloService");

MyHelloService service = new MyHelloService(wsdlLocation, serviceName);
service.sayHello("Test");

  • 没有WSDL文档文件

    QName qname = new QName("http://thenamespace", "FooService");
    FooService service = new FooService(null, qname); // null for ignore WSDL
    Foo port = service.getFooPort();
    BindingProvider bindingProvider = (BindingProvider) port;
    bindingProvider.getRequestContext()
        .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
        "http://foo.com/soap/fooBean");
    
    // Use the service
    Object obj = port.doSomething(param);
    


  • 另请参阅:


    See also: