Вопрос

I am currently testing Apache CXF (2.7.11). Purpose is to build a Web Service client. I am roughly following Martin Vereecken's blog post (http://www.bizzybee.be/2013/01/23/creating-a-java-webservice-client-in-domino-using-apache-cxf/#more-451). I have a WSDL file and I created sample code with the wsdl2java tool.

My first thought was to store the wsdl file in the NSF (e.g. WebContent\WEB-INF\resources\wsdl). However, the code generated does not seem to find the WSDL file. Code looks something like this (class name Session comes form the WSDL):

Session.java:

URL url = Session.class.getResource("WEB-INF/wsdl/twinfield/session.wsdl");
    if (url == null) {
        url = Session.class.getClassLoader().getResource("WEB-INF/wsdl/twinfield/session.wsdl");
    } 

I tried both WEB-INF and /WEB-INF but neither seem to work.

If I put the WSDL file on the web (e.g. domino/html/wsdl folder) the url above works, but the code breaks later (it seems that it uses java.io.File trying to load the WSDL).

Local reference (e.g. C:\temp\wsdl) could work but does not really sound like a robust option.

The final java code will be in WebContent\WEB-INF\src, not in Code\Java.

So, what is the "best practice" for storing and referencing WSDL files in Domino environment?

UPDATE

I went with @stwissel's proposal and noticed that the wsdl2java tool can actually create the whole jar for you. Just specify option -clientJar and the resulting JAR file will contain all class files + the wsdl file.

Это было полезно?

Решение

When you generate the Java classes from the WSDL, you should pack them into a JAR file. Put the WSDL into the Jar file, so it never gets lost. This blog article and the comments explain it.

A potential issue could be the access rights (Java execution permissions) when you keep that jar inside the NSF.

The blog entry contains the sample code, so check it out!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top