I am trying to generate a client for a web service with the WSDL_LOCATION: http://localhost:8089/SWIStoZZZws/SWIStoZZZws.asmx?WSDL
I'm using an Apache CXF 2.6.2. machine.
However, the client somehow ignores port 8089 and sent HTTP request to http://localhost/SWIStoZZZws/SWIStoZZZws.asmx?WSDL and as a result I have following error:
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '404: Not Found' when communicating with http://localhost/SWIStoZZZws/SWIStoZZZws.asmx
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1619)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1530)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1438)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:660)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 54 more
Any idea? Please help... I've been struggling with this for daaaaays. Cheers!
You can follow the official documentation in which you will find that code :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:endpoint id="classImpl"
implementor="org.apache.cxf.jaxws.service.Hello"
endpointName="e:HelloEndpointCustomized"
serviceName="s:HelloServiceCustomized"
address="http://localhost:8080/test"
xmlns:e="http://service.jaxws.cxf.apache.org/endpoint"
xmlns:s="http://service.jaxws.cxf.apache.org/service" />
</beans>
How you get endpoint address? Maybe you get endpoint address from file which is auto generate in your IDE
Related
I migrate resources from different Mule Projects to one Mule Domain Project (which should be used by all the other Mule Projects). Everything works fine except the configuration for the mongodb. If I start everything and the domain starts initialization I get the following error:
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd'
See the corresponding mule-domain-config.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<mule-domain
xmlns="http://www.mulesoft.org/schema/mule/domain"
xmlns:mule="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:mongo="http://www.mulesoft.org/schema/mule/mongo"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/domain http://www.mulesoft.org/schema/mule/domain/current/mule-domain.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.mulesoft.org/schema/mule/mongo http://www.mulesoft.org/schema/mule/mongo/current/mule-mongo.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">
<!-- configure here resource to be shared within the domain -->
<context:property-placeholder location="${mule.env}.properties "/>
<mongo:config name="mongoconfig" host="${mongo.host}" port="${mongo.port}" database="${mongo.database}" doc:name="Mongo DB" connectTimeout="5000" connectionsPerHost="1" autoConnectRetry="true" threadsAllowedToBlockForConnectionMultiplier="50" username="${mongo.username}">
<mongo:connection-pooling-profile maxActive="150" initialisationPolicy="INITIALISE_ONE" exhaustedAction="WHEN_EXHAUSTED_GROW" maxIdle="50" ></mongo:connection-pooling-profile>
<mule:reconnect frequency="1000"></mule:reconnect>
</mongo:config>
<http:listener-config name="HTTP_Listener_Configuration" host="${http.host}" port="${http.port}" doc:name="HTTP Listener Configuration"/>
</mule-domain>
My first idea was, that I need to add the mule-module-mongo dependency to the pom.xml. But this didn't change anything.
In the Mule Projects the same configuration, with the same schema declaration work just fine. Do I miss something here?
The problem is that Mongo is not supported as a shared resource so you cannot define it's config at the domain level.
You can find more information on what connectors are supported here.
HTH
I've been reading a bit about Camel and going through some of the examples in the download directory.
I would like to know if I can configure the route to accept an incoming Http request with a parameter name=fred using jetty: or servlet:
I then need to convert this to a real secured SOAP request (HTTPS) and get back the SOAP response.
Do I have to write Java code to send the SOAP request? The examples I've seen so far is using SOAP as input, modify some values and send it on as SOAP...
Anyone please provide some guidance with minimal code?
Thanks & regards
Tin
Here is what I've done and it works..
velocity_template.vm contains the entire SOAP request with dynamic fields substituted at runtime eg. ${in.headers.name}
<?xml version="1.0" encoding="UTF-8"?>
<!-- START SNIPPET: e1 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<cxf:cxfEndpoint id="real_webservice"
address="url_to_wsdl?wsdl"
endpointName="s:Real_impl_class"
xmlns:s="real_namespace"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="helloRoute">
<from uri="servlet:///hello"/>
<to uri="velocity:etc/velocity_template.vm"/>
<to uri="cxf:bean:real_webservice?dataFormat=MESSAGE"/>
</route>
</camelContext>
</beans>
<!-- END SNIPPET: e1 -->
I configure a flow in mule-config.xml based on the documentation(click here). Here is the content in mule-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:tcp="http://www.mulesoft.org/schema/mule/tcp"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:restlet="http://www.mulesource.org/schema/mule/restlet"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/tcp http://www.mulesoft.org/schema/mule/tcp/3.1/mule-tcp.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.1/mule-vm.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/3.1/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.1/mule-http.xsd
http://www.mulesoft.org/schema/mule/restlet http://www.mulesoft.org/schema/mule/restlet/3.1/mule-restlet.xsd">
<description>
This configuration uses an HTTP endpoint to receive requests.
</description>
<flow name="fuxk">
<inbound-endpoint address="http://localhost:9002">
</inbound-endpoint>
<restlet:component restlet-ref="helloWorld"/>
</flow>
<spring:bean id="helloWorld" class="com.ggd543.mulerestletdemo.HelloWorldApplication"/>
</mule>
This configuration uses an HTTP endpoint to receive requests.But when I start up the mule instance , I got the following error:
It seams that the documentation is based on mule 2.x . How do I change the configuration in mule-config.xml for Mule 3.1.2 ?
Replace mulesource.org with mulesoft.org in all your Restlet namespace definitions.
I try to implement a webservice in an existing standalone spring application.
I configured spring:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:beans/webservice.xml" />
....
webservice.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
<bean id="CheckService" class="test.ws.CheckService">
</bean>
<jaxws:endpoint
id="checkService"
implementor="#CheckService"
address="http://localhost:9000/CheckService" />
I made the configuration according to official documentation and samples from books. I get exception:
03/11/2010 09:34:12 WARN Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://cxf.apache.org/schemas/jaxws.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>.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.warning(Unknown Source)
...
http://cxf.apache.org/schemas/jaxws.xsd is accessible from browser and I think it is well formed (official xsd).
I suspect that the problem is not related to cxf rather swing configuration related.
Thanks,
Hubidubi
This means that it could not access the url when you are running it. This happens to us when we start our struts/tiles application without internet connection first. What you can do as an alternative is download the xsd and put it somewhere where you application can read it.
and replace http://cxf.apache.org/schemas/jaxws.xsd with /path/to/file/jaxws.xsd
Could it be that you're in an environment where you need to set up a proxy to access the web?
You have set the proxy in you browser and can thus access the .xsd via browser.
You need to set up your IDE appropriately or set a system-wide proxy.
Hope I guessed right :p
Finally I figured out the resolution. I had to add appropirate dependencies to maven pom.xml.
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.2</version>
</dependency>
for me works w/ this.
Clearing the files from the Eclipse cache fixed this problem for me.
In Eclipse preferences, I went to General > Network Connections > Cache and removed the cxf files that were causing the issue. The error went away the next time I validated the file.
I am using apache CXF for the first time. I am trying to establish a connection based on the CXF simple front end (Configuration notes) technology. I can't really see what I've done wrong, but I am getting a weird error (see below). I have also posted this question to users#cxf.apache.org, but I haven't received a response yet. Perhaps someone here can help.
The service bean that is wrapped here is a Spring / JPA service that does not know anything about the web, I want to use simple frontend to publish it as a web service without having to annotate it with Jax-ws etc. (This works in theory). Here's my configuration:
Server:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:cs="http://[www.mycompany.com]/coupon/service"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-autowire="byType"
>
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<!—my service implementation -->
<import resource="classpath*:persistenceContext.xml" />
<!-- serviceClass points to an interface -->
<simple:server id="server" serviceBean="couponService"
serviceClass="[com.mycompany].MyServiceInterface"
bindingId="http://apache.org/cxf/binding/http"
address="/${wsdl.path}"
serviceName="cs:couponService"
endpointName="cs:couponServicePort"
>
<simple:dataBinding>
<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
</simple:dataBinding>
<simple:binding>
<soap:soapBinding version="1.2" mtomEnabled="true" />
</simple:binding>
</simple:server>
<context:property-placeholder location="classpath:service.properties" />
</beans>
Client:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:simple="http://cxf.apache.org/simple"
xmlns:soap="http://cxf.apache.org/bindings/soap"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:oxm=http://www.springframework.org/schema/oxm
xmlns:cs="http://[www.mycompany.com]/coupon/service"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/simple http://cxf.apache.org/schemas/simple.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd"
default-autowire="byType"
>
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<simple:client id="couponService" wsdlLocation="${wsdl.url}?wsdl"
serviceName="cs:couponService"
endpointName="cs:couponServicePort"
transportId="http://schemas.xmlsoap.org/soap/http"
address="${wsdl.url}"
bindingId="http://apache.org/cxf/binding/http"
serviceClass="[com.mycompany].MyServiceInterface">
<simple:dataBinding>
<bean class="org.apache.cxf.aegis.databinding.AegisDatabinding" />
</simple:dataBinding>
<simple:binding>
<soap:soapBinding mtomEnabled="true" version="1.2" />
</simple:binding>
</simple:client>
<context:property-placeholder location="classpath:service.properties" />
On the client side, I inject the generated service into my web application (I am using wicket but that should be irrelevant) and when I call service methods on it I get an IllegalStateException from java.net.HttpURLConnection saying the connection is already open. Here’s the stack trace:
java.lang.IllegalStateException: IllegalStateException invoking http://localhost:9999/services/coupon: Already connected
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:2058)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:2048)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:639)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.binding.http.interceptor.DatabindingOutSetupInterceptor.handleMessage(DatabindingOutSetupInterceptor.java:91)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:487)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
at $Proxy30.createIndividualUserCouponsJob(Unknown Source)
at [com.mycompany].coupons.web.app.dummycontent.DummyContentInitializer.addSomeIndividualCoupons(DummyContentInitializer.java:84)
at [com.mycompany].coupons.web.app.dummycontent.DummyContentInitializer.addSomeCoupons(DummyContentInitializer.java:68)
at [com.mycompany].coupons.web.app.dummycontent.DummyContentInitializer.init(DummyContentInitializer.java:50)
at org.apache.wicket.Application.callInitializers(Application.java:843)
at org.apache.wicket.Application.initializeComponents(Application.java:678)
at org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:725)
at org.apache.wicket.protocol.http.WicketServlet.init(WicketServlet.java:219)
at javax.servlet.GenericServlet.init(GenericServlet.java:241)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:433)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:617)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:139)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1218)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:500)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:220)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at [com.mycompany].coupons.web.test.Start.main(Start.java:45)
Caused by: java.lang.IllegalStateException: Already connected
at java.net.HttpURLConnection.setFixedLengthStreamingMode(HttpURLConnection.java:103)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.thresholdNotReached(HTTPConduit.java:1889)
at org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:99)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1980)
This happens the first time a service call is made, and the only URLConnection that is opened before that is that of the wsdl.
I have searched the web for similar problems, but all I found was a bug using rest that has already been fixed. I am trying to use the simple frontend, as my service is not annotated with jax-ws annotations and I would like to keep it that way.
Can someone help? Thanks in advance.
Sean
I found the solution myself: I need to turn chunking off in the http conduit (I don't really understand a word of this :-)). Anyway, it works like this:
<http-conf:conduit name="*.http-conduit">
<http-conf:client AllowChunking="false" />
</http-conf:conduit>