I putted a text file in java class path on WSO2 Axis2 service project and uploaded it to WSO2 AS server , but my Axis2 service can not find it by ClassPathResource class. The Exception as the following:
IOException parsing XML document from class path resource [xxx.xml]
I am sure my xxx.xml file has been uploaded in the .aar package on AS server:
service.aar
...[META-INF]
...[package dir]
...xxx.xml
How to use ClassPathResource class to find a file resource under WSO2 Axis2 service??
Assuming you have the "xxx.xml" file at the top level of the hierarchy of the service archive, you can use the following java snippet to access it within the Axis2 service classes.
........
InputStream is = getClass().getResourceAsStream("/xxx.xml");
.......
Hope this helps!
Cheers,
Prabath
Related
I am trying to load WSDL using mule's Web Service Consumer but no success. If I try same WSDL from SOAPUI it works without running into any issues.
I tried below 2 options and both directing me to different issues. Any suggestion?
Option#1. Tried to load WSDL with URL gives me PKIX path building failed as below
Option#2. Also, tried to load WSDL as resource i.e. by saving it into src/main/resources folder. This gives me below
NOTE: I am using Anypoint Studio 6.4.4 with mule Community Edition 3.9 and JDK 1.8.
WSDL: https://esweb.revenue.louisiana.gov/fsettest/fsetgatewaywebservice.asmx?wsdl
you need to add the wsdl certificate to Java cacerts keystore. Here you have a useful link:
https://knowledge.digicert.com/solution/SO4085.html
On the other hand, you are getting the second error, because that wsdl you downloaded has an import of another wsdl (this is the other wsdl http://esweb.revenue.louisiana.gov/fsettest/fsetgatewaywebservice.asmx?wsdl=wsdl1).
If you want to do it this way (that I would not recommend), you will need to download all the wsdls that are imported, and reference them locally.
Our version of PI doesn't support REST web services, so we consume their SOAP web services and provide rest web service to provide REST web service support to the external entities.
I have SAP-PI WSDL file which we used to import in Eclipse that generates 9 java class files
DT_XXXX_XXXXXXXX_RQ
DT_XXXX_XXXXXXXX_RQRecordset
DT_XXXX_XXXXXXXX_RS
DT_XXXX_XXXXXXXX_RSRecordset
SI_XXXX_XXXXXXXX_OUT
SI_XXXX_XXXXXXXX_OUTBindingStub
SI_XXXX_XXXXXXXX_OUTProxy
SI_XXXX_XXXXXXXX_OUTService
SI_XXXX_XXXXXXXX_OUTServiceLocator
but when I import that WSDL file in IntelliJ it is not generating 1 java class file.
SI_XXXX_XXXXXXXX_OUTProxy
This java class is missing in IntelliJ.
Any suggestions will be appreciated.
I want to read a xml file from a WCF service.
The xml file, settings.xml is in the same folder as the service exe and the service is hosted as a Windows service.
when the service is accessed by the client the service exe is looking at system32 folder and throws file not found exception
C:\Windows\system32\Settings.xml
Here's the code which is in a try catch block and a FaultException is thrown which the client catches.
XmlSerializer serializer = new XmlSerializer(_appSettings.GetType());
StreamReader sr = new StreamReader("Settings.xml", Encoding.UTF8);
_appSettings = (SpecialityFinishingSettings)serializer.Deserialize(sr);
sr.Close();
Basically I am trying to read the xml and deserialize it into an object that can be used withing the service.
What do I do to read this file from within the service?
The serivce is installed using InstallUtil.exe
The problem is that "Settings.xml" isn't found as a file. You need to specify a full path. You can either:
Use an absolute path
Store a path in a config file. This path will be a folder that you will open files from, this can then be appended to the file name.
Get the path the app is running from as suggested by Anand (System.AppDomain.CurrentDomain.BaseDirectory + "Settings.xml";)
I added wcf service (exposed by biztalk) proxy and app.config file in VS 2005 class library project and i am calling this class library methods from windows application. In this case getting error while creating service instance, so i moved app.config file from class library to window applcation, now working fine.
Question: If i will change service url from machine001 to machine002 in config file (from bin folder but not from application) and run the app from exe file. Will it work without build.
Class library configuration always depends on configuration file (web.config / app.config) of parent application that is really using it. And Parent application should be a console / winform / ASP.NET application and can be a windows service. Any change in WinForm's app.config will change the behavior of your class library.
To Answer your question, Yes if you change service url from machine001 to machine002 in config file of windows application it will work if machine002 is hosting the WCF service.
Hope it clears your doubt.
I have wsdl file with me.But i don't have access to the file where it is deployed.
I need to generate proxy class using the WSDl file. I am getting error while using svcutil.ece to generate proxy file
Error: Cannot import wsdl:port Detail:
Cannot find definition for
http://www.cii.com/Soa/Foundation:Basi
cHttp. Service Description with
namespace
htt://www.cii.com/Soa/Foundat ion is
missing. Parameter name: name XPath to
Error Source:
//wsdl:definitions[#targetNamespace='http://www.cii.com/Soa/Foundation/MessageDefinition.xsd']/wsdl:service[#name='CareerServicesS
ervice']/wsdl:port[#name='BasicHttp']
Thanks,
Shodhan
If you are using svcutil with a locally downloaded WSDL file, you need to also download all related XSD files and pass them on the svcutil command line as well. A great tool for automatically downloading all related XSD files is disco.exe in the Windows / .NET SDK (and there may be a svcutil mode that does it as well, don't remember for sure).