Ignore missing method in JAX-WS client

12,413

Just for reference. You can also annotate the method with

@WebMethod(exclude=true)

This will make sure the method is ignored for comparing with the wsdl.

Share:
12,413

Related videos on Youtube

musiKk
Author by

musiKk

It's musiKk (6D, 75, 73, 69, 4B, 6B). Not music, musik, musick, musikK, musikk, musickk, etc... Author of plyj GitHub

Updated on September 15, 2022

Comments

  • musiKk
    musiKk over 1 year

    I have a model that is used to create a Web Service endpoint on a server. The same model is used for the client. However when a new operation is added to the server but the client still uses the older model, service creation fails with an exception like the following (line breaks added for clarity):

    Exception in thread "main" javax.xml.ws.WebServiceException:
      Method someNewMethod is exposed as WebMethod, but there is no
      corresponding wsdl operation with name someNewMethod in the
      wsdl:portType{http://example.com}MyService
    

    I understand the problem but is it possible to ignore this? I'd like to be backwards compatible when consuming the Web service. As long as methods are merely added this should work just fine most of the time.

    The problem occurs in the getPort method:

    Service s = Service.create(
        new URL("http://example.com/foo?wsdl"),
        new QName("http://example.com", "MyService"));
    MyService m = s.getPort(MyService.class);
    
  • musiKk
    musiKk over 11 years
    I'll have to see if that works. The WSDL is generated by JAX-WS and split into multiple WSDL and schema files (cuz that's how JAX-WS rolls). I guess those have to be merged or the lookup of the schemaLocation fails.
  • AlexWien
    AlexWien over 11 years
    The generated schema files source code, of course in the client stays. It is only neccessary that the schema stays compatible, and that the new fields, methods, are marked as optional (default, i think) in the server WSDL
  • AlexWien
    AlexWien over 11 years
    Updated answer, in my case it was a change attribute, not a method
  • NBPalomino
    NBPalomino almost 5 years
    This worked for me, thanks... I use Weblogic 12.2.1.3 with Java 8 and Spring Boot 1.5.15