This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

Https and wsdl

 
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You might push back on this question because it's not real java question but:
I have a java jax-ws service on tomcat.
Until now it was running on http.
I want to move it to https.
So,
I followed these instructions for creating a .keystore file
ssl tomcat
I get to my wsdl via the browser and I see it:
https://localhost:8443/services/WebService?wsdl
but my client is c#. So for creating a stub I am using their wsdl utility.
On http everything was fine but now:
I tried to do:
wsdl https://localhost:8443/services/WebService?wsdl

I got:



what does this mean? I can access the wsdl via the browser!

I tried to download the wsdl and ran: wsdl WebService.wsdl
What I got is:



Why this doesn't work now?

Thanks.
 
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by John Landon:
it's not real java question but



You might be surprised what is "real" when it comes to SOAP web services.

(java.sun.com) The WSIT Tutorial: Developing a Microsoft .NET Client

Could not establish trust relationship for the SSL/TLS secure channel. - The remote certificate is invalid according to the validation procedure.



That problem is discussed here: SVCUTIL SSL Could not establish trust relationship

Obviously there is a difference in the way svcutil and your browser deal with these types of errors. You employed the obvious work-around - make a local copy of the WSDL.

Cannot find definition for http://webservices.abc.com:WebServiceEndpointInterface. Service Description with namespace http://webservices.abc.com is missing. Parameter name: name



Basically the tool is saying that the WSDL is incomplete. Playing around with Java 6 JAX-WS I've seen some strange things in the published WSDLs. When I cobbled together the example for the Confusion in writing web service client + jax-ws topic I noticed:
  • the default namespace of "http://schemas.xmlsoap.org/wsdl/" is never declared in the WSDL- it is simply assumed.
  • The namespace for the "xsd" prefix is never declared - it is simply assumed to be "http://www.w3.org/2001/XMLSchema"
  • The namespace for the "tns" prefix is never declared - it is simply assumed to be identical to the targetNamespace.
  • The namespace for the "soap" prefix is never declared - it is simply assumed to be "http://schemas.xmlsoap.org/wsdl/soap/".



  • My guess is that the definitions element in the copy of the WSDL needs to be changed to something like:


    but I can't be sure without seeing the WSDL.

    As for getting the C# SOAP web service client to work with SSL I suggest that you poke around the MSDN.
    [ November 21, 2008: Message edited by: Peer Reynders ]
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks a lot for such wide answer. But I used the wsdl utility (I don't even have the svcutil utility
    [ November 21, 2008: Message edited by: John Landon ]
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Here is my jax-ws.xml:


    here is the wsdl:


    Thanks a lot.
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    svcutil.exe is part of the Windows SDK. wsdl.exe is part of Visual Studio. The issues remain the same.
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    For completeness sake
    https://localhost:8443/services/WebService?wsdl=1
    is also needed. That is what the tool is missing.

    So you need to make a local copy of "wsdl=1" and change the local copy of the WSDL to point to your local copy through its "location" attribute in the import element.
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    So what do I do? I just need to do it once
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I did what you said:
    wsdl:


    then I ran wsdl WebService.wsdl
    and I got:
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You have in your local WebService.wsdl:


    With the browser access "https://localhost:8443/services/WebService?wsdl=1" and "Save As" "WebService1.wsdl" in the same directory where "WebService.wsdl" is.

    Then modify your local WebService.wsdl:


    Open a console window; change your working directory to the one that contains WebService.wsdl and WebService1.wsdl. Run wsdl.exe on WebService.wsdl.
    [ November 21, 2008: Message edited by: Peer Reynders ]
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    same thing:
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The contents of https://localhost:8443/services/WebService?wsdl=1 may help to shed some light on the matter. It may be referencing another schema - or the tool isn't picking up the local WebService1.wsdl in which case one could build a single wsdl file. But for that it is necessary to see all of the referenced WSDL files and XML Schemas that are published by the web service.
    [ November 21, 2008: Message edited by: Peer Reynders ]
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    WebService1.wsdl:


    WebService.wsdl:



    WebService1.xsd:



    The message I get after running wsdl WebService.wsdl:


    [ November 21, 2008: Message edited by: John Landon ]

    [ November 21, 2008: Message edited by: John Landon ]
    [ November 21, 2008: Message edited by: John Landon ]
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    [EDIT: replaced potentially incorrect single file with corrected set of multiple files]

    This set of files compiles cleanly with wsimport - so give them a go with wsdl.exe.

    WebService.xsd



    WebService1.wsdl



    WebService.wsdl

    [ November 21, 2008: Message edited by: Peer Reynders ]
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks but it's still the same:
    Cannot find definition for http://webservices.abc.com:WebServiceEndpointInterface. Service Description with namespace http://webservices.abc.com is missing. Parameter name: name
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Originally posted by John Landon:
    Thanks but it's still the same:
    Cannot find definition for http://webservices.abc.com:WebServiceEndpointInterface.



    It seems that wsdl.exe is having problems with the WSDL import statement.
    WebService.wsdl defines the service in the "http://webservices.abc.com/" namespace.
    WebService1.wsdl defines the types that the service is based on in the "http://webservices.abc.com" namespace - note the missing backslash at the end.

    Either wsdl.exe can't read WebService1.wsdl at all or it mistakenly carries over the enclosing targetnamespace through the WDSL import - which would cause it define
    {http://webservices.abc.com/}WebServiceEndpointInterface
    rather than
    {http://webservices.abc.com}WebServiceEndpointInterface

    Is this an older version of .NET/Visual Studio?
    [ November 24, 2008: Message edited by: Peer Reynders ]
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    2005 c# express
     
    Peer Reynders
    Bartender
    Posts: 2968
    6
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    wsdl.exe Doesn't Resolve <import>'s

    So try
     
    John Landon
    Ranch Hand
    Posts: 239
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    WORKED!
    Thanks. A LOT!
    now fighting with certificates

    Thanks again
     
    Every time you till, you lose 30% of your organic matter. But this tiny ad is durable:
    Thread Boost feature
    https://coderanch.com/t/674455/Thread-Boost-feature
    reply
      Bookmark Topic Watch Topic
    • New Topic