NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

WebService,SSL,wsimport,get wsdl problem

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
developer-si



Joined: 21 Aug 2010
Posts: 10

PostPosted: Sat Aug 21, 2010 12:48 pm    Post subject: WebService,SSL,wsimport,get wsdl problem Reply with quote

Hey everyone!

- I have a WebService that I secured using Message Authentication over SSL mechanism.
- I also added a Security Constraint into web.xml for that WebService and it is configured ok I think because the <soap:address> parameter in the wsdl has the SSL url of the WebService:
Code:
<soap:address location="https://localhost:8181/TrappWeb/OrdersWebService"/>


The problem I have is when I create a Web Service Client in the client app I can't specify in the wizard the WSDL file of the Web Service from Project because the NON SSL url of the Web Service is trying to get set (in form: http://localhost:8080/...).

How can I configure things so the wizard will pick the Web Service wsdl from the SSL url?

As a work-around I manually set the WSDL URL instead of choosing it from the project. But now I got another problem:
When the wsimport utility creates the CompaniesWebService.java file (the name of the WS is CompaniesWebService) in the Generated Sources (jax-ws) package, the wsdl url is getting set with the class.getResource() method instead of calling constructor new Url() in the static block of the file. That causes me an exception: WebServiceException: Cannot find '<SSL URL>' wsdl. Place the resource correctly in the classpath.

I have to manually correct the code as follows (commented code is wsimport generated):
Code:

//        COMPANIESWEBSERVICE_WSDL_LOCATION = si.zaki.trapp.web.webservices.CompaniesWebService.class.getResource("https://localhost:8181/TrappWeb/CompaniesWebService?wsdl");
//        WebServiceException e = null;
//        if (COMPANIESWEBSERVICE_WSDL_LOCATION == null) {
//            e = new WebServiceException("Cannot find 'https://localhost:8181/TrappWeb/CompaniesWebService?wsdl' wsdl. Place the resource correctly in the classpath.");
//        }
//        COMPANIESWEBSERVICE_EXCEPTION = e;
        URL url = null;
        WebServiceException e = null;
        try {
            url = new URL("https://localhost:8181/TrappWeb/CompaniesWebService?wsdl");
        } catch (MalformedURLException ex) {
            e = new WebServiceException(ex);
        }
        COMPANIESWEBSERVICE_WSDL_LOCATION = url;
        COMPANIESWEBSERVICE_EXCEPTION = e;


Then everything works and also calling the Web Service operation from the client app works well. The problem of this work-around is that whenever I refresh the web service in the client app, I have to manually correct mentioned code in every WebService.java file!

Thanks for any help!

Regards
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo