Axis2 generates wrong WSDL, where is the error? - wsdl

I've used NetBeans plugin "Axis2 Support" to create webservice from my pojo class.
When I go to create the client from wsdl file I get some errors.
Here is the message:
[ERROR] missing required property "style" of element "operation"
This is an example of element operation that generates the error:
<wsdl:operation name="addObjectPropertyAssertion">
<wsdl:input message="ns:addObjectPropertyAssertionRequest" wsaw:Action="urn:addObjectPropertyAssertion"/>
<wsdl:fault message="ns:EcourbStorageServiceInvalidURIException" name="EcourbStorageServiceInvalidURIException" wsaw:Action="urn:addObjectPropertyAssertionEcourbStorageServiceInvalidURIException"/>
<wsdl:fault message="ns:EcourbStorageServiceInvalidURIReferenceException" name="EcourbStorageServiceInvalidURIReferenceException" wsaw:Action="urn:addObjectPropertyAssertionEcourbStorageServiceInvalidURIReferenceException"/>
</wsdl:operation>
Deploying web service I've just some errors like this (I will correct it after, I don't think is the cause)
[WARN] We don't support method overloading. Ignoring [addRDFTriple]
Using some simple service operation in browser it works.

I found the solution: the problem was methods with void return. Set a return value of any type solves the problem.

Related

Liquigraph schema files missing?

We have a service in our site that uses neo4j for the database. Today when I tried to load up the service for development the project bombs out. I'm getting errors like this:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquigraph' defined in class path resource [org/liquigraph/spring/starter/LiquigraphAutoConfiguration$LiquigraphConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException:
cvc-elt.1: Cannot find the declaration of element 'changelog'.
and this:
2021-08-02 14:43:41.516 WARN 9650 --- [ restartedMain] o.l.core.io.xml.ChangelogParser : XSD validation warning : schema_reference.4: Failed to read schema document 'http://www.liquigraph.org/schema/1.0/liquigraph.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
in my terminal.
I went to the site listed in the error and it doesn't work. There is also this one which is pretty similar but gives a 404.
our pom.xml file lists this for liquigraph:
<!-- https://mvnrepository.com/artifact/org.liquigraph/liquigraph-spring-boot-starter -->
<dependency>
<groupId>org.liquigraph</groupId>
<artifactId>liquigraph-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
In researching the project I saw something about running it "offline" or something. How can I get the project to load with the XSD files missing?
This should be fixed now.
I just deployed a new version of the website and misconfigured a couple of things (wrong CNAME file location, wrong schema files location).
https://www.liquigraph.org/schema/1.0/liquigraph.xsd and http://www.liquigraph.org/schema/1.0/liquigraph.xsd should work fine now.
More recent releases of Liquigraph also support schema location redirects such as the latest 3.x and 4.x. Make sure to upgrade!

Implementing DI using Unity (design time configuration) in Web API 2

I am working on implementing DI using Unity in Web API Layer. Following is the error message I am getting while calling the Service -
Resolution of the dependency failed, type =
"API.Controllers.LeadController", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The current type,
Business.ILeadManager, is an interface and cannot be constructed. Are
you missing a type mapping?
At the time of the exception, the container was:
Resolving API.Controllers.LeadController,(none)
Resolving parameter "leadManager" of constructor
API.Controllers.LeadController(Business.ILeadManager leadManager)
Resolving Business.ILeadManager,(none)
Any suggestions, what is wrong ?
Your unity configuration is missing a mapping for type Business.ILeadManager, so unity does not know which object instance it should create.
There should be an entry for your type like:
<register type="Business.ILeadManager" mapTo="MyLeadManagerImplementation" />

Why Spring crashes with "No bean named .. is defined" when configuring RabbitMQ queues using a system property and SpEL?

I have the following code in my context XML (among other things):
<rabbit:queue name="#{systemProperties.consumer1Queue}" />
<rabbit:fanout-exchange name="si.test.exchange">
<rabbit:bindings>
<rabbit:binding queue="#{systemProperties.consumer1Queue}"/>
</rabbit:bindings>
</rabbit:fanout-exchange>
I first compile it using mvn compile. Then, when I want to run it with mvn -Dconsumer1Queue=queue1 exec:java it throws:
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name
'org.springframework.amqp.rabbit.config.BindingFactoryBean#0': Cannot
resolve reference to bean '#{systemProperties.consumer1Queue}' while
setting bean property 'destinationQueue'; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
bean named 'queue1' is defined at
[...]
The exception stops occurring when I either:
change the <rabbit:queue ...> element to <rabbit:queue name="queue1" />, or
comment out the <rabbit:fanout-exchange ...> element.
This is Spring Integration version 4.1.1
Why is this happening? Could this be related to this bug?
Many thanks!
You aren't correct. See binding's queue attribute docs:
The bean name of the Queue to bind to this exchange.
So, you should add id to the <rabbit:queue> and use it as a value of the binding's queue attribute.

Custom Error Handler in Wso2 Mediation

In my In sequence mediatior, I need to process some logic on the input values and based on that i need to decide whether to call the webservice or return a fault. I have defined the sequence as following
<sequence xmlns="http://ws.apache.org/ns/synapse" name="m1">
<class name="com.myclass">
</class>
<makefault version="soap11">
<code xmlns:soap11Env="http://schemas.xmlsoap.org/soap/envelope/" value="soap11Env:Client"/>
<reason value="ERROR_MESSAGE"/>
<role>Acc</role>
<detail>Test Details</detail>
</makefault>
<log/>
</sequence>
The problem is by default the webservice is always passing fault information to the webservice. How do i make of the following
1. Incase the there is an custom exception thrown in Mediator, soap fault is thrown back to the webservice client.
2. Incase all the information are correct, the webservice is called properly and client gets the proper response.
You need to define a separate sequence to handle the faults. Then, in your InSequence, you need to set that fault sequence to the "onError" attribute. So your InSequence will look like
<sequence xmlns="http://ws.apache.org/ns/synapse" name="m1" onError="yourFaultSequence">
<class name="com.myclass">
</class>
<log/>
<send/>
</sequence>
Above configuration was added to give an idea. Note the onError attribute.
Following sample will also help.

Activation error occured while trying to get instance of type LogWriter, key ""

I am getting this error while loggin into eventviewer. I am looging the exception in event viewer as well as rolling flat file. If i remove the eventviewer section then rolling flat file works perfectly, but only when i add this it gives the exception
{"Resolution of the dependency failed, type =
\"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter\", name =
\"(none)\".\r\nException occurred while: while resolving.\r\nException
is: InvalidOperationException - The type TraceListener cannot be
constructed. You must configure the container to supply this
value.\r\n-----------------------------------------------\r\nAt the
time of the exception, the container was:\r\n\r\n Resolving
Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl,LogWriter.default
(mapped from Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,
(none))\r\n Resolving parameter \"structureHolder\" of constructor
Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterImpl(Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder
structureHolder,
Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider
instrumentationProvider,
Microsoft.Practices.EnterpriseLibrary.Logging.ILoggingUpdateCoordinator
updateCoordinator)\r\n Resolving
Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,LogWriterStructureHolder.default
(mapped from
Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder,
(none))\r\n Resolving parameter \"traceSources\" of constructor
Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterStructureHolder(System.Collections.Generic.IEnumerable1[[Microsoft.Practices.EnterpriseLibrary.Logging.Filters.ILogFilter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35]] filters,
System.Collections.Generic.IEnumerable1[[System.String, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
traceSourceNames,
System.Collections.Generic.IEnumerable1[[Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35]] traceSources,
Microsoft.Practices.EnterpriseLibrary.Logging.LogSource
allEventsTraceSource,
Microsoft.Practices.EnterpriseLibrary.Logging.LogSource
notProcessedTraceSource,
Microsoft.Practices.EnterpriseLibrary.Logging.LogSource
errorsTraceSource, System.String defaultCategory, System.Boolean
tracingEnabled, System.Boolean logWarningsWhenNoCategoriesMatch,
System.Boolean revertImpersonation)\r\n Resolving
Microsoft.Practices.EnterpriseLibrary.Logging.LogSource,General\r\n
Resolving parameter \"traceListeners\" of constructor
Microsoft.Practices.EnterpriseLibrary.Logging.LogSource(System.String
name,
System.Collections.Generic.IEnumerable1[[System.Diagnostics.TraceListener,
System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089]] traceListeners,
System.Diagnostics.SourceLevels level, System.Boolean autoFlush,
Microsoft.Practices.EnterpriseLibrary.Logging.Instrumentation.ILoggingInstrumentationProvider
instrumentationProvider)\r\n Resolving
System.Diagnostics.TraceListener,Event Log Trace Listener\r\n"}
I had the same problem and it was due to an error in my configuration file. I referenced trace listeners from my categorySources section which did not exist in my listeners section. I removed the categories and the mappings (i did not use them anyway) and then it worked. I guess you can validate your configuration file in the configuration console and then it will tell you what the problem is.
1 - Make sure you are referencing the correct DLLs
Microsoft.Practices.EnterpriseLibrary.Logging
Microsoft.Practices.EnterpriseLibrary.Common
2 - Make sure your configuration file is in the right location (in the same project or in a references project)
3 - Make sure your configuration file is correct. Editing it with the Enterprise Library Configuration Tool, nothing should be in red. Try expanding all trace listeners, categories, etc. The most common error is that one of the Special Categories is pointing to a non existing Listener.
I had a similar experience with ExceptionHanlder., I switched over to using Unity container directly after playing around with intro material re: logging.
I basically just copied the examples from the Help files and briefly wondered why it wasn't working and errored on Type Resolution; Could not resolve.
The answer was simple enough. I had only "played" with logging prior to switching to Unity container but the examples I was using/copying were using both Logging and Exception Handling injection.
Since I hadn't "played: with Exception Handling in 5.0, there were no entries for this in the configuration file, hence the reason why Unity could not resolve.
Solution: take 5 seconds to add the ExceptionHandling block into the config file using the tools and I was good to go and keep on "playing".
Unity needs the entries for each resolved block in the config file even if they are not Named / customised. This is rediculously obvious but easily overlloked if you are hacking away with example code for learning purposes.
I got this error because a database listener was set with a connection string that didn't exist.
To help diagnose, comment out the listener lines and then add them again one by one.
I got this error when moving the app to another server, and in my case, it was the initializeData field, which sets the path for the log file, was not valid, and it was not able to create the log file at startup.
When i edited and put a valid path for the log to be created, it worked ok.
Hope it helps someone.

Resources