Namespace issues with Enunciate - java

I have a jax-ws project that is using Enunciate with Maven to build into a war file. When I deploy it to my app-server, I get weird namespace issues when trying to test with SoapUI. The xml request will have the correct namespace prefix for my complex-type, but when the request is submitted to the server, the object is always null.
Here is my web service interface:
#WebService(targetNamespace = "http://namespace.com/dog/service")
public interface DogSoapService {
#WebMethod
public Dog submit(
#WebParam(name = "dog")
Dog dog) throws MyWebFault;
This builds fine with enunciate, but when I try to make a request via SoapUI, the 'dog' object comes over to the server as null.
If I disable enunciate's 'assemble' goal in maven, and I add the 'targetNamespace' to my dog WebParam, then the request works perfectly with SoapUI.
#WebService(targetNamespace = "http://namespace.com/dog/service")
public interface DogSoapService {
#WebMethod
public Dog submit(
#WebParam(name = "dog", targetNamespace = "http://namespace.com/dog/model")
Dog dog) throws MyWebFault;
However, if I try to build my project with the 'assemble' goal, the deployment fails with this error:
javax.xml.ws.WebServiceException: class com.myproject.dog.ws.jaxws.Submit do not have a property of the name {http://namespace.com/dog/model}dog
at com.sun.xml.ws.server.sei.EndpointArgumentsBuilder$DocLit.<init>(EndpointArgumentsBuilder.java:513)
...
Caused by: javax.xml.bind.JAXBException: {http://namespace.com/dog/model}dog is not a valid property on class com.myproject.dog.ws.jaxws.Submit
...
Caused By: javax.xml.bind.JAXBException: {http://namespace.com/dog/model}dog is not a valid property on class com.myproject.dog.ws.jaxws.Submit
...
Truncated. see log file for complete stacktrace
I see that there is some sort of disconnect between the enunciate generated 'Submit' request wrapper class and my 'Dog' object, but for the life of me, I cannot solve it. Please help! Thanks in advance.

What happens when you disable the jaxws-support module?
<enunciate>
...
<modules>
...
<jaxws-support disabled="true"/>
</modules>
</enunciate>

Related

Dynamic TCP Server with Spring Integration using Java DSL

I am trying to create a TCP server and client by reading the property files which contains the detail of the connections.
I am using Dynamic and runtime Integration Flows with the help of following reference document (
9.20 Dynamic and runtime Integration Flows)
The code is working fine while creating the client but when I am creating the server using the same with changes in the code as follow:
IntegrationFlow flow = f -> f
.handle(Tcp.inboundAdapter(Tcp.netServer(2221)
.serializer(TcpCodecs.crlf())
.deserializer(TcpCodecs.lengthHeader1())
.id("server")))
.transform(Transformers.objectToString());
IntegrationFlowRegistration theFlow = this.flowContext.registration(flow).register();
I am getting the following error:
Caused by: java.lang.IllegalArgumentException: Found ambiguous parameter type [class java.lang.String] for method match: [public java.lang.Class<?> org.springframework.integration.dsl.IntegrationComponentSpec.getObjectType(), public S org.springframework.integration.dsl.MessageProducerSpec.outputChannel(java.lang.String), public S org.springframework.integration.dsl.MessageProducerSpec.outputChannel(org.springframework.messaging.MessageChannel), public org.springframework.integration.ip.dsl.TcpInboundChannelAdapterSpec org.springframework.integration.ip.dsl.TcpInboundChannelAdapterSpec.taskScheduler(org.springframework.scheduling.TaskScheduler), public S org.springframework.integration.dsl.MessageProducerSpec.errorMessageStrategy(org.springframework.integration.support.ErrorMessageStrategy), public S org.springframework.integration.dsl.MessageProducerSpec.phase(int), public S org.springframework.integration.dsl.MessageProducerSpec.autoStartup(boolean), public S org.springframework.integration.dsl.MessageProducerSpec.sendTimeout(long)]
at org.springframework.util.Assert.isNull(Assert.java:155)
at org.springframework.integration.util.MessagingMethodInvokerHelper.findHandlerMethodsForTarget(MessagingMethodInvokerHelper.java:843)
at org.springframework.integration.util.MessagingMethodInvokerHelper.<init>(MessagingMethodInvokerHelper.java:362)
at org.springframework.integration.util.MessagingMethodInvokerHelper.<init>(MessagingMethodInvokerHelper.java:231)
at org.springframework.integration.util.MessagingMethodInvokerHelper.<init>(MessagingMethodInvokerHelper.java:225)
at org.springframework.integration.handler.MethodInvokingMessageProcessor.<init>(MethodInvokingMessageProcessor.java:60)
at org.springframework.integration.handler.ServiceActivatingHandler.<init>(ServiceActivatingHandler.java:38)
at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:924)
at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:904)
at org.springframework.integration.dsl.IntegrationFlowDefinition.handle(IntegrationFlowDefinition.java:891)
at org.springframework.integration.samples.dynamictcp.DynamicTcpClientApplication.lambda$1(DynamicTcpClientApplication.java:194)
at org.springframework.integration.config.dsl.IntegrationFlowBeanPostProcessor.processIntegrationFlowImpl(IntegrationFlowBeanPostProcessor.java:268)
at org.springframework.integration.config.dsl.IntegrationFlowBeanPostProcessor.postProcessBeforeInitialization(IntegrationFlowBeanPostProcessor.java:96)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1702)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583)
... 16 common frames omitted
Please help me with above issue.
Also I have found the code for dynamic tcp client but no code is present for dynamic tcp server(any resource or link where I can take an idea to create dynamic server).
You are mixing responsibility. The Tcp.inboundAdapter() must be a first in the IntegrationFlow chain. Consider to use this instead:
IntegrationFlow flow =
IntegrationFlows.from(Tcp.inboundAdapter(Tcp.netServer(2221)
.serializer(TcpCodecs.crlf())
.deserializer(TcpCodecs.lengthHeader1())
.id("server")))
.transform(Transformers.objectToString())
.get();

Entity declaration inside EAR

This is the structure of my projects:
AppEjb -> DAO, Remote Beans
AppEjbClient -> DTO, Interfaces
AppEjbEAR -> The EAR with additional libs
AppWS -> The Web Service, using AppEjb with #Inject and #EJB
Right now, my entities are all inside AppEjb and I use the DTO to transfer one entity to the WebService call.
I would like to declare my entities inside my AppEjbClient. But when I do this, all my queries stop working with the following error message:
org.eclipse.persistence.exceptions.JPQLException
Exception Description: Problem compiling [SELECT u FROM User].
The abstract schema type 'User' is unknown.
What am I doing wrong here?
Where's the right place for persistence.xml?
If possible, I wouldn't like to have to type every entity in my persistence.xml.

How to use a controller inside a folder in the controllers folder with Play framework 1.4.3

I'm working with Play framework 1.4.3 and my problem is that i created a new folder inside in the controllers folder and in this new folder added new controllers class and I did the same with a folder of the views but when in my html , i tried to declared in the href of a tag ancla the route , this not it found my controller created, only found the controller for default "Application.java".
Example:
This is my folder hierarchy
I can use a controller inside a folder in the controllers folder with Play Framework 1.4.3?
This is my MyServicesControlle:
package controllers.myServices;
import play.mvc.Controller;
public class MyServicesController extends Controller {
public static void index() {
render();
}
}
when i write the whole path in a tag ancla:
my services
throws this exception:
19:11:34,868 ERROR ~
#73mb1o6aa
Internal Server Error (500) for request GET /application/index
Oops: PatternSyntaxException
An unexpected error occured caused by exception PatternSyntaxException: group redeclaration controller; use ({=name}...) for group reassignments
play.exceptions.UnexpectedException: Unexpected Error
at play.Invoker$Invocation.onException(Invoker.java:245)
at play.Invoker$Invocation.run(Invoker.java:307)
at Invocation.HTTP Request(Play!)
Caused by: jregex.PatternSyntaxException: group redeclaration controller; use ({=name}...) for group reassignments
at jregex.Term.makeTree(jregex/Term.java:299)
at jregex.Term.makeTree(jregex/Term.java:219)
at jregex.Term.makeTree(jregex/Term.java:206)
at jregex.Pattern.compile(jregex/Pattern.java:164)
at jregex.Pattern.<init>(jregex/Pattern.java:150)
at jregex.Pattern.<init>(jregex/Pattern.java:108)
at play.mvc.Router$Route.compute(Router.java:828)
at play.mvc.Router.getRoute(Router.java:142)
at play.mvc.Router.appendRoute(Router.java:126)
at play.mvc.Router.parse(Router.java:208)
at play.mvc.Router.parse(Router.java:173)
at play.mvc.Router.load(Router.java:53)
at play.mvc.Router.detectChanges(Router.java:232)
... 1 more
first it was necessary to reference the folder where the controller was located, followed by the name of the controller and then the action.
Following the previous example:
my services

ClassCastException thrown on Component.getInstance(GateAction.class, true)

I am new in Seam. I am using Rest services and in one of my rest service I am trying to get Instance by Component like,
GateAction gateAction = (GateAction) Component.getInstance(GateAction.class, true);
So with this I got error java.lang.IllegalStateException: No application context active
then to resolve this I call Lifecycle.beginCall() and Lifecycle.endCall() methods as below,
Lifecycle.beginCall();
GateActionIntf gateAction = (GateActionIntf) Component.getInstance(GateActionImpl.class, true);
Lifecycle.endCall();
where GateActionIntf is an Interface and GateActionImpl is seam component which implements GateActionIntf. But now I am getting ClassCastException.
Note : In my web service project I don't have any component.xml and seams based configuration, I have just added jboss-seam jar
Is that possible to get instance like that, without any component.xml and seams configuration? Again just highlighting I am getting the Instance but while type casting throws ClassCastException. how to resolve this?
Give the following a try:
GateActionIntf gateAction = (GateActionImpl) Component.getInstance(GateActionImpl.class, true);

JAXWS runtime exception

I am using JBoss 5.1.0GA and jaxws-api 2.1.1 and maven and my webservice is
#WebMethod
public GenericResponse getExternalSystems() throws java.rmi.RemoteException{
return engineExternal.getExternalSystems();
}
The runtime exception that I get on deploy is the following:
Caused by: org.jboss.ws.WSException: arg0 is not a valid property on class ClassName
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(JAXBContextImpl.java:971)
at org.jboss.ws.metadata.accessor.JAXBAccessorFactory.create(JAXBAccessorFactory.java:49)
at org.jboss.ws.metadata.umdm.EndpointMetaData.createAccessor(EndpointMetaData.java:763)
at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitializeAccessors(EndpointMetaData.java:697)
at org.jboss.ws.metadata.umdm.EndpointMetaData.initializeInternal(EndpointMetaData.java:569)
at org.jboss.ws.metadata.umdm.EndpointMetaData.eagerInitialize(EndpointMetaData.java:557)
at org.jboss.ws.metadata.umdm.ServiceMetaData.eagerInitialize(ServiceMetaData.java:433)
at org.jboss.ws.metadata.umdm.UnifiedMetaData.eagerInitialize(UnifiedMetaData.java:199)
at org.jboss.wsf.stack.jbws.EagerInitializeDeploymentAspect.start(EagerInitializeDeploymentAspect.java:48)
at org.jboss.webservices.integration.deployers.WSDeploymentAspectDeployer.internalDeploy(WSDeploymentAspectDeployer.java:107)
at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
... 30 more
I have found some solutions that use ant tasks:
http://billytee.wordpress.com/2009/09/03/jboss-jax-ws-is-not-a-valid-property-on-class/
http://www.javalinux.it/wordpress/2009/03/16/ant-171-and-package-infojava-compilation-problem-of-jax-ws-generated-classes/
But I use maven, so I can't use these solutions.
What can I do?
This error occurs when parameters are not properly annotated in the web service implementation.
Make sure that all params are annotated.
For eg:
#WebParam(name="param_name")
where param_name implies the name of the element as present in the WSDL.

Categories