1 Reply Latest reply on Feb 13, 2012 12:19 PM by spyhunter99

    JBoss WS temp file problem

    David Balakirev Newbie

      Hi JBoss Forum,

      Forgive me that i just paste my problem here (from stackoverflow):

      My problem from yesterday is say sorted. Not solved though.

      The the NPE i had was triggered by a FileNotFoundException that was hidden until i switched to TRACE logging (org.jboss.util.xml.JBossEntityResolver)...

      So here is the thing: 1.) I'm trying to connect to the webservice from code that is deployed to under JBoss 2.) JBossWs saves the wsdl to the tmp folder like this:


      3.) And then when it tries to read back the WSDL:

      TRACE [org.jboss.util.xml.JBossEntityResolver] Failed to obtain URL.InputStream from systemId: file:/home/xxx/dev/xxx-PAN/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.comany.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd
      .io.FileNotFoundException: /home/xxx/dev/xxx-PAN/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.comany.xx_99_server_soap.php

      Obviusly it truncates and then not able to read back...

      I guess i would be able to configurate somehow the pattern how it writes it to disk or how it reads it back but i did find the solution (even not from the code of the JBoss class i mentioned). Any ideas would be appreciated.

      Many thanks, Dave


      I created a simple test application on the linux server pointig to the same file containing the following code:

      URL url = new URL("file:/home/abos/xxx/xxxx/jboss-4.2.3.GA/server/xxxxxxx/tmp/jbossws/JBossWS_www.company.xx_99_server_soap.php?wsdl=get8489235369016302536.xsd");

      Exception in thread "main" java.io.FileNotFoundException: /home/xxx/dev/xxxx/jboss-4.2.3.GA/server/anchorage/tmp/jbossws/JBossWS_www.bdmglobal.xx_99_server_soap.php (No such file or directory)
          at java
      .io.FileInputStream.open(Native Method)
          at java
          at java
          at sun
          at sun
          at java

      So here are my conclusions: 1.) Actually it is the URL class that truncates the name 2.) But if it was saved properly it would not be a problem...

      So i'm still looking for a way to configure that.

        • 1. Re: JBoss WS temp file problem
          spyhunter99 Novice

          Here's what I do. This example comes from a WSN publisher I'm working on.


          For the record, I prefer the Microsoft approach for building web services/clients. Read the wsdl at development time only. Most java stacks read the wsdl at runtime which makes things challenging at times.


          Long story short, put a copy of the wsdl and xsd files into the jar file that creates the proxy (not necessarily the jar containing the interface classes) in /META-INF


          Modify the generated WebServiceClient class to have a static field representing the QName that defines the service (from the wsdl). More than likely, the Qname is already in the class, it's just not a public field.


          public static QName qname = new QName("http://docs.oasis-open.org/wsn/brw-2", "NotificationService");



          Modify the code that creates the client proxy object to load the wsdl from META-INF. Both are required if you need this code to work from with Sun's JDK and OpenJDK


                        URL wsdl = Thread.currentThread().getContextClassLoader().getResource("META-INF/brw-2impl.wsdl");

                      if (wsdl == null) {

                          wsdl = Thread.currentThread().getContextClassLoader().getResource("/META-INF/brw-2impl.wsdl");


                      if (wsdl == null) {

                          ok = false;

                          log.log(Level.FATAL, "Unable to obtain a URL for the local wsdl, publication is not possible");


                      org.oasis_open.docs.wsn.brw_2.NotificationService ns = new NotificationService(wsdl, NotificationService.qname);

                      NotificationBroker notificationPort = ns.getNotificationPort();



          Insert the correct endpoint url here


                      BindingProvider bp = (BindingProvider) notificationPort;

                      Map<String, Object> context = bp.getRequestContext();

                      context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, brokerurl);



          hope this helps