Morning friends. I've been fighting and hacking at trying to implement a web service client to read a local wsdl at runtime but it no matter how I try it, the I cannot seem to get a runtime defined WSDL location working. The wsdl is good, it compiles fine, and I can verify the path I'm giving it.
The primary challenge is that I cannot hardcode the final wsdl location into the web service because the remote web service and its WSDL are password protected. Since I cannot provide credentials at the time the service stub instantiates ( maybe there's a way, I don't know how ) I am trying to tell the service class to use a local wsdl within the deployed war, but this isn't working.
By comparison, I can access a local WSDL just fine when accessing the service within Eclipse using a static class with main().
The specific error JBoss gives me is:
2010-06-30 13:04:22,890 DEBUG [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8) URL proto: vfszip
2010-06-30 13:04:22,890 DEBUG [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8)
---URL PATH: [/C:/jboss-5.1.0.GA/server/default/deploy/NetworkLocationService-STL4.war/WEB-INF/wsdl/AssetAPIService.wsdl]
2010-06-30 13:04:22,890 DEBUG [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8) #*#
2010-06-30 13:04:22,890 DEBUG [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8) assetApiService = new AssetAPIService( erl )
2010-06-30 13:04:23,108 WARN [org.jboss.util.xml.JBossEntityResolver] (http-127.0.0.1-8080-8) Trying to resolve systemId as a non-file URL: http://location.api.mobileview.aeroscout.com
2010-06-30 13:04:23,124 WARN [org.jboss.ws.core.utils.JBossWSEntityResolver] (http-127.0.0.1-8080-8) Trying to resolve id as a non-file URL: http://location.api.mobileview.aeroscout.com
2010-06-30 13:04:23,124 ERROR [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8) #-!!!-#
2010-06-30 13:04:23,124 ERROR [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8) Exception: null
2010-06-30 13:04:23,124 ERROR [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8) org.jboss.ws.metadata.wsdl.xmlschema.JBossXSEntityResolver.getXMLInputSource(JBossXSEntityResolver.java:170)
2010-06-30 13:04:23,124 ERROR [com.boeing.ntpm.nls.api.ws.AssociationGet] (http-127.0.0.1-8080-8) org.jboss.ws.metadata.wsdl.xmlschema.JBossXSEntityResolver.resolveEntity(JBossXSEntityResolver.java:136)
...
The file path is entirely accurate, the file object says it doesn't exist I presume because it could not read the zipped WSDL. The protocol value for the URL object created by the returned file object is 'vfszip'. I see that the URL adds a parent '/' to it's own path, but I don't know if that's a problem or how to prevent it.
I don't know why the JBossEntityResolver is attempting to resolve a namespace as a URL and I can't tell where it's occuring.
Here's the representative code that leads to the error:
...
erl = AssociationGet.class.getClassLoader().getResource("./../wsdl/AssetAPIService.wsdl");
if ( null == erl ) { log.debug( "URL is NULL!!!" ); }
log.debug( "URL proto: " + erl.getProtocol());
log.debug( "\n---URL PATH: [" + erl.getPath() + "]" );
log.debug( "#*#" );
}
catch (Exception e)
{
log.error( "#!!!# ");
log.error( "Exception: " + e.getMessage() );
log.error( e.getStackTrace()[0] );
log.error( e.getStackTrace()[1] );
log.error( e.getStackTrace()[2] );
log.error( e.getStackTrace()[3] );
log.error( "#!!!#" );
throw new Exception("WSDL not found");
}
AssetAPIService assetApiService = null;
try
{
log.debug( "assetApiService = new AssetAPIService( erl )" );
assetApiService = new AssetAPIService( erl );
...
Here's the code for AssetAPIService( URL url ):
public AssetAPIService(URL wsdlLocation) {
super(
wsdlLocation,
new QName("http://service.api.mobileview.aeroscout.com", "AssetAPIService"));
}
So from the wsdl location "./../wsdl/AssetAPIService.wsdl" and a valid QName that says nothing of 'location', I'm getting an error about "Trying to resolve systemId as a non-file URL: http://location.api.mobileview.aeroscout.com".
Does anyone have any pointers on what I might be doing wrong, or any examples they can point to about how to refer to a local wsdl within a deployed war file at runtime? Thanks!