Thanks.
I got this to work but got into another trouble.
I followed the wsdl and edited as apt.
Here is my own wsdl:
<wsdl:definitions name="isServices" xmlns:types="http://services.is/types
"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://services.is"
xmlns:jms="http://cxf.apache.org/transports/jms"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
targetNamespace="http://services.is">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://services.is/types"
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
elementFormDefault="qualified">
<complexType name="isBinary">
<sequence>
<element name="name" type="xsd:string" />
<element name="attachinfo" type="xsd:base64Binary"
xmime:expectedContentTypes="application/octet-stream"/>
</sequence>
</complexType>
<element name="isBinary" type="types:isBinaryType"/>
</schema>
</wsdl:types>
<wsdl:message name="sendAttachmentRequest">
<wsdl:part name="data" element="types:isBinary"/>
</wsdl:message>
<wsdl:portType name="isServicesPortType">
<wsdl:operation name="sendAttachment">
<wsdl:input message="tns:sendAttachmentRequest"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="isServicesBinding"
type="tns:isServicesPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="sendAttachment">
<soap:operation soapAction="http://services.is/sendAttachment
"
/>
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="isServices">
<wsdl:port name="isServicesJmsPort"
binding="tns:isServicesBinding">
<jms:address
destinationStyle="queue"
jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicQueues/i.s">
<jms:JMSNamingProperty
name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
<jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616"/>
</jms:address>
<jms:client messageType="byte"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Here is my xbean for the JMS consumer:
<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:is="http://services.is">
<cxfbc:consumer wsdl="classpath:isServices.wsdl"
service="is:isServices"
targetService="is:isFTPWriter"
mtomEnabled="true"/>
</beans>
Here is the xbean for the target service which I guess is an in-only
MEP:
<beans xmlns:ftp="http://servicemix.apache.org/ftp/1.0"
xmlns:is="http://services.is">
<bean id="myMarshaler"
class="org.apache.servicemix.components.util.BinaryFileMarshaler"/>
<ftp:sender service="is:isFTPWriter"
endpoint="isFTPWriter"
uri="ftp://is:i...@localhost/"
overwrite="true"
uploadSuffix=".dat"
marshaler="#myMarshaler">
</ftp:sender>
</beans>
The project is suppose to achieve the flow below:
JMS producer -> JMS Consumer -> NMR -> FTPWriter
where JMS producer is the java client code to send binary files
Here is the java client code for sending an attachment to the jms
consumer
String fileName = "file.dat";
byte[] payload = getBytesFromFile(fileName);
String dest = "dynamicQueues/i.s";
Properties env = new Properties();
if (System.getProperty("java.naming.provider.url") == null)
env.put("java.naming.provider.url", "tcp://localhost:61616");
if (System.getProperty("java.naming.factory.initial") == null)
env.put("java.naming.factory.initial",
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
InitialContext ic = new InitialContext(env);
ConnectionFactory confac = (ConnectionFactory)
ic.lookup("ConnectionFactory");
Connection connection = confac.createConnection();
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer((Destination)
ic.lookup(dest));
BytesMessage bm = session.createBytesMessage();
bm.writeBytes(payload);
producer.send(bm);
connection.close();
However I end up with this exception
Aug 5, 2009 11:35:21 AM
org.apache.cxf.transport.jms.JMSDestination$JMSExecutor run
INFO: run the incoming message in the threadpool
Aug 5, 2009 11:35:21 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: No namespace on "FRAMESET"
element.at
org
.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handle
Message(ReadHeadersInterceptor.java:86)
at
org
.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor.handle
Message(ReadHeadersInterceptor.java:54)
at
org
.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:220)
at
org
.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti
ationObserver.java:78)
at
org
.apache.cxf.transport.jms.JMSDestination.incoming(JMSDestination.j
ava:209)
at
org.apache.cxf.transport.jms.JMSDestination
$JMSExecutor.run(JMSDestin
ation.java:352)
at
java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExec
utor.java:650)
at
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor
.java:675)
at java.lang.Thread.run(Thread.java:595)
Aug 5, 2009 11:35:21 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
java.lang.UnsupportedOperationException: A destination must be
specified.
at
org
.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProdu
cer.java:195)
at
org
.apache.activemq.ActiveMQQueueSender.send(ActiveMQQueueSender.java
:133)
at
org.apache.cxf.transport.jms.JMSDestination
$JMSOutputStream.sendRespo
nse(JMSDestination.java:528)
at
org.apache.cxf.transport.jms.JMSDestination
$JMSOutputStream.commitOut
putMessage(JMSDestination.java:473)
at
org.apache.cxf.transport.jms.JMSDestination
$JMSOutputStream.doClose(J
MSDestination.java:547)
at
org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:
16
7)
at
org
.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:6
6)
at
org.apache.cxf.interceptor.MessageSenderInterceptor
$MessageSenderEndi
ngInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org
.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:220)
at
org
.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMess
age(AbstractFaultChainInitiatorObserver.java:96)
at
org
.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseIntercept
orChain.java:260)
at
org
.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainIniti
ationObserver.java:78)
at
org
.apache.cxf.transport.jms.JMSDestination.incoming(JMSDestination.j
ava:209)
at
org.apache.cxf.transport.jms.JMSDestination
$JMSExecutor.run(JMSDestin
ation.java:352)
at
java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExec
utor.java:650)
at
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor
.java:675)
at java.lang.Thread.run(Thread.java:595)
Freeman Fang wrote:
Hi,
A couple of issues in your wsdl
1. The jms namespace in your wsdl isn't valid for cxf, it should be
http://cxf.apache.org/transports/jms
instead,
2. Also, the binding part in your wsdl is incorrect, it should use
soap binding, but not jms binding, jms is transport, not binding.
3. To use mtom, your wsdl should define element with something like
xmime:expectedContentTypes="application/octet-stream"
4. And the jms:address in your port part is incorrect.
We have an wsdl example[1] how the wsdl should look like when use
soap
binding over jms transport with mtom enabled, and a testcase[2]
which use this wsdl and in this testcase there's a cxf bc consumer
using mtom/soap/jms, I guess you may need take a look at those
example.
[1]https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/resources/org/apache/servicemix/cxfbc/mtom_xop.wsdl
[2]https://svn.apache.org/repos/asf/servicemix/components/bindings/servicemix-cxf-bc/trunk/src/test/java/org/apache/servicemix/cxfbc/CxfBcHttpJmsBridgeMtomTest.java
Freeman
On 2009-8-4, at 下午8:17, lekkie wrote:
Hi Freeman,
After following your advice, I got this far.
Here is the exception thrown during deployment of my sa:
Caused by: org.apache.cxf.endpoint.EndpointException
at
org
.apache.cxf.endpoint.EndpointImpl.createBinding(EndpointImpl.java:
132)
at org.apache.cxf.endpoint.EndpointImpl.<init>(EndpointImpl.java:
81)
at
org
.apache
.servicemix.cxfbc.CxfBcConsumer.validate(CxfBcConsumer.java:
402)
... 13 more
Caused by: org.apache.cxf.BusException: No binding factory for
namespace
http://schemas.sun.com/jbi/wsdl-extensions/jms/ registered.
at
org
.apache
.cxf
.binding
.BindingFactoryManagerImpl
.getBindingFactory(BindingFactoryManagerImpl.java:91)
at
org
.apache.cxf.endpoint.EndpointImpl.createBinding(EndpointImpl.java:
129)
... 15 more
Here is the content of my wsdl
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="isJMSConsumer" targetNamespace="http://services.is
"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://services.is"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:jms="http://schemas.sun.com/jbi/wsdl-extensions/jms/">
<types/>
<message name="isJMSConsumerOperationRequest">
<part name="part1" type="xsd:base64Binary"/>
</message>
<portType name="isJMSConsumerPortType">
<operation name="isJMSConsumerOperation">
<input name="input1"
message="tns:isJMSConsumerOperationRequest"/>
</operation>
</portType>
<binding name="isJMSConsumerBinding"
type="tns:isJMSConsumerPortType">
<jms:binding/>
<operation name="isJMSConsumerOperation">
<jms:operation destination="Queue/A"
destinationType="Queue"/>
<input name="input1">
<jms:message messageType="BytesMessage"
bytesPart="part1"
forwardAsAttachment="true"/>
</input>
</operation>
</binding>
<service name="isJMSConsumerService">
<port name="isJMSConsumerPort"
binding="tns:isJMSConsumerBinding">
<jms:address connectionURL="mq://localhost:7676"/>
</port>
</service>
<plnk:partnerLinkType name="isJMSConsumer">
<plnk:role name="isJMSConsumerPortTypeRole"
portType="tns:isJMSConsumerPortType"/>
</plnk:partnerLinkType>
</definitions>
and here is my xbean.xml
<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
xmlns:is="http://services.is">
<!-- wsdlResource="classpath:isFileConsumer.wsdl" -->
<cxfbc:consumer wsdl="classpath:isJMSConsumer.wsdl"
service="is:isJMSConsumerService"
targetService="is:isFTPWriter"
mtomEnabled="true"/>
</beans>
thanks.
Freeman Fang wrote:
Hi,
If you want to send attachment over soap with jms transport,
could
you
consider to use the cxf bc component with mtom over jms
transport?
Freeman
On 2009-8-3, at 下午8:02, lekkie wrote:
Hi Guys,
While trying to create a WSDL for my consumer JMS BC on
servicemix I
got the
following error
<loc-message>WSDL is not WS-I BP compliant: [binding
"{http://services.is}isJMSFileConsumerInBinding" : Basic Profile
Violation
#R2401: A wsdl:binding element in a DESCRIPTION MUST use WSDL
SOAP
Binding
as defined in WSDL 1.1 Section 3.]</loc-message>
<stack-trace><![CDATA[javax.jbi.management.DeploymentException:
WSDL
is not
WS-I BP compliant: [binding "{http://
services.is}isJMSFileConsumerInBinding"
: Basic Profile Violation #R2401: A wsdl:binding element in a
DESCRIPTION
MUST use WSDL SOAP Binding as defined in WSDL 1.1 Section 3.]
at
org
.apache
.servicemix
.jms
.endpoints
.JmsSoapConsumerEndpoint
.validateWsdl1(JmsSoapConsumerEndpoint.java:
198)
at
org
.apache
.servicemix
.jms
.endpoints
.JmsSoapConsumerEndpoint.validate(JmsSoapConsumerEndpoint.java:
138)
While the exception is in itself self explanatory, I ws
wondering
what the
best way it is to generate a WSDL.
Here is the WSDL I generated from Netbeans wizard:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="isJMSFileConsumer"
targetNamespace="http://services.is
"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://services.is"
xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype"
xmlns:jms="http://schemas.sun.com/jbi/wsdl-extensions/jms/">
<types/>
<message name="isJMSFileConsumerInOperationRequest">
<part name="part1" type="xsd:base64Binary"/>
</message>
<portType name="isJMSFileConsumerInPortType">
<operation name="isJMSFileConsumerInOperation">
<input name="input1"
message="tns:isJMSFileConsumerInOperationRequest"/>
</operation>
</portType>
<binding name="isJMSFileConsumerInBinding"
type="tns:isJMSFileConsumerInPortType">
<jms:binding/>
<operation name="isJMSFileConsumerInOperation">
<jms:operation destination="DefaultQueue"
destinationType="Queue"/>
<input name="input1">
<jms:message messageType="BytesMessage"
bytesPart="part1"/>
</input>
</operation>
</binding>
<service name="isJMSFileConsumerIn">
<port name="isJMSFileConsumerInPortType"
binding="tns:isJMSFileConsumerInBinding">
<jms:address connectionURL="mq://localhost:61616"/>
</port>
</service>
<plnk:partnerLinkType name="isJMSFileConsumer">
<!-- A partner link type is automatically generated when a
new port
type is added. Partner link types are used by BPEL processes.
In a BPEL process, a partner link represents the interaction
between
the
BPEL process and a partner service. Each partner link is
associated
with a
partner link type.
A partner link type characterizes the conversational
relationship
between
two services. The partner link type can have one or two
roles.-->
<plnk:role name="isJMSFileConsumerInPortTypeRole"
portType="tns:isJMSFileConsumerInPortType"/>
</plnk:partnerLinkType>
</definitions>
And here is the xbean.xml for this service unit
<beans xmlns:jms="http://servicemix.apache.org/jms/1.0"
xmlns:is="http://services.is"
xmlns:amqpool="http://jencks.org/amqpool/2.0">
<classpath>
<location>.</location>
</classpath>
<bean id="connectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory">
<property name="connectionFactory">
<bean
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:
61616" />
</bean>
</property>
<!--Configure maximum connections used by the pool -->
<property name="maxConnections" value="10" />
<!--Configure maximum sessions per connection -->
<property name="maximumActive" value="10" />
</bean>
<!-- add the sender endpoint here -->
<bean id="myMarshaler"
class
="org.apache.servicemix.components.util.BinaryFileMarshaler"/>
<jms:soap-consumer service="is:isJMSFileConsumer"
endpoint="isJMSFileConsumer"
wsdl="classpath:isJMSFileConsumer.wsdl"
validateWsdl="true"
targetService="is:isFTPWriter"
destinationName="queue/A/Soap"
connectionFactory="#connectionFactory"/>
</beans>
What is the best way to generate a WSDL for a binary message
(attachment)
through JMS BC over SOAP?
kr.
--
View this message in context:
http://www.nabble.com/Binary-Message-WSDL-for-JMS-BC-%28Consumer%29-tp24789561p24789561.html
Sent from the ServiceMix - User mailing list archive at
Nabble.com.
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com
--
View this message in context:
http://www.nabble.com/Binary-Message-WSDL-for-JMS-BC-%28Consumer%29-tp24789561p24807302.html
Sent from the ServiceMix - User mailing list archive at
Nabble.com.
--
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com
--
View this message in context:
http://www.nabble.com/Binary-Message-WSDL-for-JMS-BC-%28Consumer%29-tp24789561p24824802.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.