While strating servicemix, here is the output from the console:
INFO - ComponentMBeanImpl - Initializing component:
servicemix-xmpp
INFO - ServiceAssemblyLifeCycle - Starting service assembly:
instantissuance-sa
INFO - ServiceUnitLifeCycle - Initializing service unit:
instantissuance-ftpwriter-su
INFO - ServiceUnitLifeCycle - Initializing service unit:
instantissuance-file-consumer-su
Aug 21, 2009 4:49:16 PM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be null
Aug 21, 2009 4:49:16 PM org.apache.cxf.transport.jms.JMSDestination activate
INFO: JMSServerTransport activate()....
INFO - ServiceUnitLifeCycle - Starting service unit:
instantissuance-ftpwriter-su
INFO - ServiceUnitLifeCycle - Starting service unit:
instantissuance-file-consumer-su
INFO - JBIContainer - ServiceMix JBI Container
(ServiceMix) started
INFO - JDBCAdapterFactory - Database driver recognized:
[apache_derby_embedded_jdbc_driver]
INFO - LogTask - Logging system reconfigured using
file:
file:/C:/Program%20Files/Apache%20Software%20Foundation/apache-servicemix-3.3/c
onf/log4j.xml
Client code here:
public final class
InstantIssuanceServicesPortType_InstantIssuanceServicesJmsPort_Client {
private static final QName MTOM_SERVICE = new
QName("http://services.instantissuance", "InstantIssuanceServices");
public final static QName MTOM_PORT = new
QName("http://services.instantissuance", "InstantIssuanceServicesJmsPort");
private
InstantIssuanceServicesPortType_InstantIssuanceServicesJmsPort_Client() {
}
public static void main(String args[]) throws Exception {
InstantIssuanceServicesPortType_InstantIssuanceServicesJmsPort_Client
client = new
InstantIssuanceServicesPortType_InstantIssuanceServicesJmsPort_Client();
client.sendAttachment();
System.exit(0);
}
public void sendAttachment() throws Exception {
try
{
InstantIssuanceServicesPortType mtomPort =
createPort(MTOM_SERVICE,
MTOM_PORT, InstantIssuanceServicesPortType.class, true);
String fileName = "C:\\myfile.html";
File file = new File(fileName);
FileInputStream in = new FileInputStream(file);
int fileSize = 0;
for (int i = in.read(); i != -1; i = in.read())
fileSize++;
int count = 50;
byte[] data = new byte[fileSize * count];
for (int x = 0; x < count; x++)
in.read(data, fileSize * x, fileSize);
System.out.println("Invoking testXop...");
String _testXop_nameVal = "Attachment";
Holder<String> _testXop_name = new
Holder<String>(_testXop_nameVal);
DataHandler _testXop_attachinfoVal = new DataHandler(new
ByteArrayDataSource(data, "application/octet-stream"));;
Holder<DataHandler> _testXop_attachinfo = new
Holder<DataHandler>(_testXop_attachinfoVal);
mtomPort.testXop(_testXop_name, _testXop_attachinfo);
System.out.println("testXop._testXop_name=" +
_testXop_name.value);
System.out.println("testXop._testXop_attachinfo=" +
_testXop_attachinfo.value);
} catch (SOAPFaultException ex) {
Assert.assertTrue("Expect the configuration exception here",
ex.getCause() instanceof
org.apache.cxf.configuration.ConfigurationException);
}
}
private static <T> T createPort(QName serviceName, QName portName,
Class<T> serviceEndpointInterface, boolean enableMTOM) throws Exception
{
Bus bus = BusFactory.getDefaultBus();
ReflectionServiceFactoryBean serviceFactory = new
JaxWsServiceFactoryBean();
serviceFactory.setBus(bus);
serviceFactory.setServiceName(serviceName);
serviceFactory.setServiceClass(serviceEndpointInterface);
URL url = new URL("file:wsdl/instantIssuanceServices.wsdl");
serviceFactory.setWsdlURL(url);
Service service = serviceFactory.create();
EndpointInfo ei = service.getEndpointInfo(portName);
JaxWsEndpointImpl jaxwsEndpoint = new JaxWsEndpointImpl(bus,
service, ei);
SOAPBinding jaxWsSoapBinding = new
SOAPBindingImpl(ei.getBinding());
jaxWsSoapBinding.setMTOMEnabled(enableMTOM);
jaxwsEndpoint.getBinding().getInInterceptors().add(new
TestMultipartMessageInterceptor());
jaxwsEndpoint.getBinding().getOutInterceptors().add(new
TestAttachmentOutInterceptor());
Client client = new ClientImpl(bus, jaxwsEndpoint);
InvocationHandler ih = new JaxWsClientProxy(client,
jaxwsEndpoint.getJaxwsBinding());
Object obj =
Proxy.newProxyInstance(serviceEndpointInterface.getClassLoader(), new
Class[] {
serviceEndpointInterface, BindingProvider.class }, ih);
return serviceEndpointInterface.cast(obj);
}
}
Thanks.
Freeman Fang wrote:
>
> Hi,
> It seems ok.
> Do you see any exception when you deploy your SA?
> And could you append the complete code of your standalone jms client?
>
> Freeman
> On 2009-8-21, at 下午11:15, lekkie wrote:
>
>>
>> Here is it:
>>
>> <wsdl:service name="InstantIssuanceServices">
>> <wsdl:port name="InstantIssuanceServicesJmsPort"
>> binding="tns:InstantIssuanceServicesBinding">
>> <jms:address
>> destinationStyle="queue"
>> jndiConnectionFactoryName="ConnectionFactory"
>> jndiDestinationName="dynamicQueues/person.queue">
>> <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>
>>
>>
>>
>>
>> Freeman Fang wrote:
>>>
>>> Hi,
>>>
>>> What's the service part of your instantIssuanceServices.wsdl?
>>> Freeman
>>>
>>> On 2009-8-21, at 下午10:47, lekkie wrote:
>>>
>>>>
>>>> Thanks.
>>>>
>>>> See xbean xml below:
>>>>
>>>> <beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0"
>>>> xmlns:instantissuance="http://services.instantissuance">
>>>>
>>>> <cxfbc:consumer wsdl="classpath:instantIssuanceServices.wsdl"
>>>> service="instantissuance:instantIssuanceServices"
>>>> targetService="instantissuance:instantissuanceFTPWriter"
>>>> mtomEnabled="true"/>
>>>> </beans>
>>>>
>>>> kr.
>>>>
>>>>
>>>> Freeman Fang wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> Can you post the xbean.xml for your cxf bc consumer?
>>>>> Seems your cxf bc comsumer not configured correctly with jms
>>>>> transport, so it can't pick up the soap message from the jms queue
>>>>> which your jms client send soap message with attachment to.
>>>>>
>>>>> Freeman
>>>>> On 2009-8-21, at 下午4:50, lekkie wrote:
>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I am trying to send an attachement from a client to service cxf-
>>>>>> bc.
>>>>>>
>>>>>> Here is suppose to be the flow
>>>>>>
>>>>>> client -> cxf-bc concumer -> NMR -> ftp-sender
>>>>>>
>>>>>> Here is my client software for sending
>>>>>> InstantIssuanceServicesPortType mtomPort =
>>>>>> createPort(MTOM_SERVICE,
>>>>>> MTOM_PORT, InstantIssuanceServicesPortType.class, true);
>>>>>> String fileName = "C:\\esocketweb_trace.html";
>>>>>> File file = new File(fileName);
>>>>>> FileInputStream in = new FileInputStream(file);
>>>>>>
>>>>>> int fileSize = 0;
>>>>>> for (int i = in.read(); i != -1; i = in.read())
>>>>>> fileSize++;
>>>>>>
>>>>>> int count = 50;
>>>>>> byte[] data = new byte[fileSize * count];
>>>>>> for (int x = 0; x < count; x++)
>>>>>> in.read(data, fileSize * x, fileSize);
>>>>>> String _testXop_nameVal = "Attachment";
>>>>>> Holder<String> _testXop_name = new
>>>>>> Holder<String>(_testXop_nameVal);
>>>>>> DataHandler _testXop_attachinfoVal = new DataHandler(new
>>>>>> ByteArrayDataSource(data, "application/octet-stream"));;
>>>>>> Holder<DataHandler> _testXop_attachinfo = new
>>>>>> Holder<DataHandler>(_testXop_attachinfoVal);
>>>>>> mtomPort.testXop(_testXop_name, _testXop_attachinfo);
>>>>>>
>>>>>>
>>>>>> Whenever I send, the send thread is bloeked forever and there is
>>>>>> no
>>>>>> sign of
>>>>>> it getting to servicemix.
>>>>>>
>>>>>> Here is my wsdl
>>>>>>
>>>>>> <?xml version="1.0" encoding="utf-8"?>
>>>>>> <!--
>>>>>> Licensed to the Apache Software Foundation (ASF) under one
>>>>>> or more contributor license agreements. See the NOTICE file
>>>>>> distributed with this work for additional information
>>>>>> regarding copyright ownership. The ASF licenses this file
>>>>>> to you under the Apache License, Version 2.0 (the
>>>>>> "License"); you may not use this file except in compliance
>>>>>> with the License. You may obtain a copy of the License at
>>>>>>
>>>>>>
>>>>>> http://www.apache.org/licenses/LICENSE-2.0
>>>>>>
>>>>>>
>>>>>> Unless required by applicable law or agreed to in writing,
>>>>>> software distributed under the License is distributed on an
>>>>>> "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>>>>>> KIND, either express or implied. See the License for the
>>>>>> specific language governing permissions and limitations
>>>>>> under the License.
>>>>>> -->
>>>>>>
>>>>>> <wsdl:definitions name="SOAPBuilders-mime-cr-test"
>>>>>> xmlns:types="http://services.instantissuance/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.instantissuance"
>>>>>> xmlns:jms="http://cxf.apache.org/transports/jms"
>>>>>> xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
>>>>>> targetNamespace="http://services.instantissuance">
>>>>>>
>>>>>> <wsdl:types>
>>>>>> <schema xmlns="http://www.w3.org/2001/XMLSchema"
>>>>>> targetNamespace="http://services.instantissuance/types"
>>>>>> xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
>>>>>> elementFormDefault="qualified">
>>>>>> <complexType name="XopType">
>>>>>> <sequence>
>>>>>> <element name="name" type="xsd:string" />
>>>>>> <element name="attachinfo"
>>>>>> type="xsd:base64Binary"
>>>>>> xmime:expectedContentTypes="application/octet-stream"/>
>>>>>> </sequence>
>>>>>>
>>>>>> </complexType>
>>>>>> <complexType name="XopStringType">
>>>>>> <sequence>
>>>>>> <element name="name" type="xsd:string" />
>>>>>> <element name="attachinfo"
>>>>>> type="xsd:base64Binary"
>>>>>> xmime:expectedContentTypes="text/plain; charset=utf-8"/>
>>>>>> </sequence>
>>>>>> </complexType>
>>>>>>
>>>>>> <element name="testXop" type="types:XopType" />
>>>>>> <element name="testXopResponse" type="types:XopType" />
>>>>>>
>>>>>> <element name="testXopStringArgument"
>>>>>> type="types:XopStringType"/>
>>>>>> <element name="testXopStringResponse"
>>>>>> type="types:XopStringType"/>
>>>>>> </schema>
>>>>>>
>>>>>> </wsdl:types>
>>>>>>
>>>>>> <wsdl:message name="testXopIn">
>>>>>> <wsdl:part name="data" element="types:testXop"/>
>>>>>> </wsdl:message>
>>>>>>
>>>>>> <wsdl:message name="testXopOut">
>>>>>> <wsdl:part name="data" element="types:testXopResponse" />
>>>>>> </wsdl:message>
>>>>>>
>>>>>> <wsdl:message name="testXopStringIn">
>>>>>> <wsdl:part name="data"
>>>>>> element="types:testXopStringArgument" />
>>>>>> </wsdl:message>
>>>>>>
>>>>>> <wsdl:message name="testXopStringOut">
>>>>>> <wsdl:part name="data"
>>>>>> element="types:testXopStringResponse" />
>>>>>>
>>>>>> </wsdl:message>
>>>>>>
>>>>>> <wsdl:portType name="InstantIssuanceServicesPortType">
>>>>>> <wsdl:operation name="testXop">
>>>>>> <wsdl:input message="tns:testXopIn"/>
>>>>>> <wsdl:output message="tns:testXopOut"/>
>>>>>> </wsdl:operation>
>>>>>>
>>>>>> <wsdl:operation name="testXopString">
>>>>>> <wsdl:input message="tns:testXopStringIn" />
>>>>>> <wsdl:output message="tns:testXopStringOut"/>
>>>>>> </wsdl:operation>
>>>>>> </wsdl:portType>
>>>>>>
>>>>>> <wsdl:binding name="InstantIssuanceServicesBinding"
>>>>>> type="tns:InstantIssuanceServicesPortType">
>>>>>> <soap:binding style="document"
>>>>>> transport="http://schemas.xmlsoap.org/soap/http" />
>>>>>>
>>>>>> <wsdl:operation name="testXop">
>>>>>> <soap:operation soapAction="" />
>>>>>> <wsdl:input>
>>>>>> <soap:body use="literal" />
>>>>>> </wsdl:input>
>>>>>> <wsdl:output>
>>>>>> <soap:body use="literal" />
>>>>>> </wsdl:output>
>>>>>> </wsdl:operation>
>>>>>>
>>>>>> <wsdl:operation name="testXopString">
>>>>>> <soap:operation soapAction="" />
>>>>>> <wsdl:input>
>>>>>> <soap:body use="literal" />
>>>>>> </wsdl:input>
>>>>>> <wsdl:output>
>>>>>> <soap:body use="literal" />
>>>>>> </wsdl:output>
>>>>>> </wsdl:operation>
>>>>>>
>>>>>> </wsdl:binding>
>>>>>>
>>>>>> <wsdl:service name="InstantIssuanceServices">
>>>>>> <!--
>>>>>> <wsdl:port name="InstantIssuanceServicesPort"
>>>>>> binding="tns:InstantIssuancesServicesBinding">
>>>>>> <soap:address location="http://localhost:9036/mime-
>>>>>> test" />
>>>>>> </wsdl:port>
>>>>>> -->
>>>>>> <wsdl:port name="InstantIssuanceServicesJmsPort"
>>>>>> binding="tns:InstantIssuanceServicesBinding">
>>>>>> <jms:address
>>>>>> destinationStyle="queue"
>>>>>> jndiConnectionFactoryName="ConnectionFactory"
>>>>>> jndiDestinationName="dynamicQueues/person.queue">
>>>>>> <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:service name="InstantIssuanceServicesProviderService">
>>>>>> <wsdl:port name="InstantIssuanceServicesProviderJmsPort"
>>>>>> binding="tns:InstantIssuanceServicesBinding">
>>>>>> <jms:address
>>>>>> destinationStyle="queue"
>>>>>> jndiConnectionFactoryName="ConnectionFactory"
>>>>>> jndiDestinationName="dynamicQueues/person.queue">
>>>>>> <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>
>>>>>>
>>>>>>
>>>>>> Kindly help out.
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/No-trace-on-servicemix-
>>>>>> tp25075918p25075918.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/No-trace-on-servicemix-
>>>> tp25075918p25081259.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/No-trace-on-servicemix-tp25075918p25081783.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/No-trace-on-servicemix-tp25075918p25082455.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.