File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Https and wsdl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Https and wsdl" Watch "Https and wsdl" New topic
Author

Https and wsdl

John Landon
Ranch Hand

Joined: Sep 25, 2008
Posts: 227
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.
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2906
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 ]

    "Don't succumb to the false authority of a tool or model. There is no substitute for thinking."
    Andy Hunt, Pragmatic Thinking & Learning: Refactor Your Wetware p.41
    John Landon
    Ranch Hand

    Joined: Sep 25, 2008
    Posts: 227
    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

    Joined: Sep 25, 2008
    Posts: 227
    Here is my jax-ws.xml:


    here is the wsdl:


    Thanks a lot.
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    svcutil.exe is part of the Windows SDK. wsdl.exe is part of Visual Studio. The issues remain the same.
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    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

    Joined: Sep 25, 2008
    Posts: 227
    So what do I do? I just need to do it once
    John Landon
    Ranch Hand

    Joined: Sep 25, 2008
    Posts: 227
    I did what you said:
    wsdl:


    then I ran wsdl WebService.wsdl
    and I got:
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    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

    Joined: Sep 25, 2008
    Posts: 227
    same thing:
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    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

    Joined: Sep 25, 2008
    Posts: 227
    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

    Joined: Aug 19, 2005
    Posts: 2906
    [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

    Joined: Sep 25, 2008
    Posts: 227
    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

    Joined: Aug 19, 2005
    Posts: 2906
    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

    Joined: Sep 25, 2008
    Posts: 227
    2005 c# express
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2906
    wsdl.exe Doesn't Resolve <import>'s

    So try
    John Landon
    Ranch Hand

    Joined: Sep 25, 2008
    Posts: 227
    WORKED!
    Thanks. A LOT!
    now fighting with certificates

    Thanks again
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Https and wsdl
     
    Similar Threads
    JNI Tutorial (Step 5)
    TOMCAT - SSL Configuration
    Using a tomcat-based web service in .NET
    Call Webservice methods from the URL addresss
    Java service and c# client https