Configuring the cxf-bc-su service unit
Wiki Markup |
---|
{scrollbar} |
On this page , we are going to
Excerpt |
---|
configure the cxf-bc-su to provide our service webservice |
Configuring the pom.xml
First of all we move into the created folder my-cxf-bc-su.
Changing the project name
In order to make the build output a little bit more comprehensible , we first change the project name in the generated pom.xml file.
No Format |
---|
<project> ... <name>CXF WSDL Tutorial :: CXF BC SU</name> ... </project> |
Editing service.wsdl to
...
configure our
...
webservice
We must have to edit the WSDL file service.wsdl in src/main/resources directory folder to provide configure our servicewebservice.
Here is an example for the method SayHello.
Code Block | |||||||
---|---|---|---|---|---|---|---|
| |||||||
| |||||||
<?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 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://mycompanyservicemix.apache.comorg/helloexamples" xmlns:typens="http://mycompanyservicemix.apache.comorg/helloexamples/types" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="hello" targetNamespace="http://mycompanyservicemix.apache.comorg/helloexamples"> <wsdl:types> <xsd:schema targetNamespace="http://mycompanyservicemix.apache.comorg/helloexamples/types" elementFormDefault="qualified"> <xsd:element name="SayHello"> <xsd:complexType> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="SayHelloResponse"> <xsd:complexType> <xsd:sequence> <xsd:element name="name" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="UnknownWordFault"> <xsd:complexType> <xsd:sequence> <xsd:element name="word" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </wsdl:types> <wsdl:message name="SayHelloRequest"> <wsdl:part name="payload" element="typens:SayHello"/> </wsdl:message> <wsdl:message name="SayHelloResponse"> <wsdl:part name="payload" element="typens:SayHelloResponse"/> </wsdl:message> <wsdl:message name="UnknownWordFault"> <wsdl:part name="payload" element="typens:UnknownWordFault"/> </wsdl:message> <wsdl:portType name="Hello"> <wsdl:operation name="SayHello"> <wsdl:input message="tns:SayHelloRequest"/> <wsdl:output message="tns:SayHelloResponse"/> <wsdl:fault name="UnknownWord" message="tns:UnknownWordFault"/> </wsdl:operation> </wsdl:portType> <wsdl:binding name="HelloSOAPBinding" type="tns:Hello"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" /> <wsdl:operation name="SayHello"> <wsdl:input> <soap:body use="literal" /> </wsdl:input> <wsdl:output> <soap:body use="literal" /> </wsdl:output> <wsdl:fault name="UnknownWord"> <soap:fault use="literal" name="UnknownWord" /> </wsdl:fault> </wsdl:operation> </wsdl:binding> <wsdl:service name="HelloService"> <wsdl:port binding="tns:HelloSOAPBinding" name="soap"> <soap:address location="http://localhost:8193/HelloService/" /> </wsdl:port> </wsdl:service> </wsdl:definitions> |
Configuring the xbean.xml
Next , we will have to configure our new SU to really provide some services. We do this by modifying a file
named xbean.xml in the src/main/resources directory folder of our my-cxf-bc-su module. We must fill in
We have to configure it according to the service.wsdl.
Here is example for our service.wsdl.an example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
No Format | ||||||||
<beans xmlns:cxfbc="http://servicemix.apache.org/cxfbc/1.0" xmlns:hello="http://mycompanyservicemix.apache.comorg/helloexamples"> <cxfbc:consumer wsdl="classpath:service.wsdl" targetService="hello:HelloService" targetInterface="hello:Hello"/> </beans> |
Next, we are going to create cxf-se service unit.
Things to remember
- In ServiceMix, most service units will be configured by a file named xbean.xml
Proceed to the next step
Wiki Markup |
---|
{scrollbar} |