ข้ามไปที่เนื้อหาหลัก

[ ServiceMix ] SOAP provider example

example files exists here or


ServiceMix can act as a SOAP server/provider of Chamber of Commerce.
Client --- SOAP -------> Server --- XML --> Server Stub unmarshal ( same interface as biz logic ) -----> Biz Logic Implementation ( Simple JavaCode )

Client <-- Response -- Server <--- XML -- Server Stub marshal <----- Biz Logic Implementation find companies at a specific city and specific street message
<findCompanies>
<city>city name</city>
<streetName>street name</streetName>
</findCompanies>


XMLSchema of message
<xsd:element name="findCompanies">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="city" type="xsd:string" />
<xsd:element name="streetName" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>


resources/cfx/wsdl/CoC.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions xmlns:osesb="http://opensource.esb.org/CoC/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="CoC"
targetNamespace="http://opensource.esb.org/CoC/">

<!-- We have three operations: changeCompany (in-only), findCompanies (in-out),
and getCompany (in-out). -->

<!-- Define an XML Schema for the elements use in the in and out SOAP messages. -->

<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://opensource.esb.org/CoC/">

<!-- define the elements which go into our methods -->

<xsd:element name="changeCompany">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="companyName" type="xsd:string" />
<xsd:element name="companyInfo" type="osesb:company" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="findCompanies">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="city" type="xsd:string" />
<xsd:element name="streetName" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="findCompaniesResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="companies" type="osesb:listOfCompanies"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="getCompany">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="companyName" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="getCompanyResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="company" type="osesb:company" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<!-- define the types -->

<xsd:complexType name="listOfCompanies">
<xsd:sequence>
<xsd:element name="company" type="osesb:company" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="company">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="boardOfDirectors" type="osesb:boardOfDirectors" />
<xsd:element name="address" type="osesb:address" />
</xsd:sequence>
<xsd:attribute name="cocID" type="xsd:string" />
</xsd:complexType>

<!-- Defines the board that manages this corporation -->
<xsd:complexType name="boardOfDirectors">
<xsd:sequence>
<xsd:element name="director" type="osesb:director" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>

<!-- Defines a single director -->
<xsd:complexType name="director">
<xsd:sequence>
<xsd:element name="firstName" type="xsd:string" />
<xsd:element name="lastName" type="xsd:string" />
<xsd:element name="dateOfBirth" type="xsd:date" />
<xsd:element name="address" type="osesb:address" />
</xsd:sequence>
</xsd:complexType>

<!-- defines a simple address -->
<xsd:complexType name="address">
<xsd:sequence>
<xsd:element name="street" type="xsd:string" />
<xsd:element name="number" type="xsd:integer" />
<xsd:element name="city" type="xsd:string" />
<xsd:element name="state" type="xsd:string" />
<xsd:element name="zipcode" type="osesb:zip" />
<xsd:element name="country" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>

<!-- defines the zip type -->
<xsd:simpleType name="zip">
<xsd:restriction base="xsd:string">
<xsd:pattern value="[0-9]{5}" />
</xsd:restriction>
</xsd:simpleType>

</xsd:schema>
</wsdl:types>

<!-- Define the SOAP messages needed for our three operations -->

<!-- The request for the changeCompany operation -->
<wsdl:message name="changeCompanyRequest">
<wsdl:part element="osesb:changeCompany" name="parameters" />
</wsdl:message>
<!-- The request for the findCompanies operation -->
<wsdl:message name="findCompaniesRequest">
<wsdl:part element="osesb:findCompanies" name="parameters" />
</wsdl:message>
<!-- The response for the findCompanies operation -->
<wsdl:message name="findCompaniesResponse">
<wsdl:part element="osesb:findCompaniesResponse" name="parameters" />
</wsdl:message>
<!-- The request for the getCompany operation -->
<wsdl:message name="getCompanyRequest">
<wsdl:part element="osesb:getCompany" name="parameters" />
</wsdl:message>
<!-- The response from the getCompanyOperation -->
<wsdl:message name="getCompanyResponse">
<wsdl:part element="osesb:getCompanyResponse" name="parameters" />
</wsdl:message>

<!-- Define the CoC interface/porttype, which pairs up the request/response
messages as needed and gives the operations their names. -->

<wsdl:portType name="CoCPortType">
<wsdl:operation name="changeCompany">
<wsdl:input message="osesb:changeCompanyRequest" />
</wsdl:operation>
<wsdl:operation name="findCompanies">
<wsdl:input message="osesb:findCompaniesRequest" />
<wsdl:output message="osesb:findCompaniesResponse" />
</wsdl:operation>
<wsdl:operation name="getCompany">
<wsdl:input message="osesb:getCompanyRequest" />
<wsdl:output message="osesb:getCompanyResponse" />
</wsdl:operation>
</wsdl:portType>

<!-- Specify "document/literal" binding, which allows arbitrary XML,
specified using XML Schema, to be passed as the SOAP body. Also
specify HTTP as the transport. -->

<wsdl:binding name="CoCSoapBinding" type="osesb:CoCPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<!-- alternative is style="RPC" -->

<wsdl:operation name="changeCompany">
<soap:operation soapAction="http://opensource.esb.org/CoC/changeCompany" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
</wsdl:operation>
<wsdl:operation name="findCompanies">
<soap:operation soapAction="http://opensource.esb.org/CoC/findCompanies" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getCompany">
<soap:operation soapAction="http://opensource.esb.org/CoC/getCompany" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>

<!-- And finally define the service endpoint -->

<wsdl:service name="CoCService">
<wsdl:port binding="osesb:CoCSoapBinding" name="CoCSoap">
<soap:address location="http://localhost:8080/services/coc" />
</wsdl:port>
</wsdl:service>

</wsdl:definitions>


download apache-cxf library
extract to ESB Folder
drag resources/example4-build.xml to ant-view
>> cxf-generate-server-stubs

it will create /src-generated
write our wsdl -> java class

/src/ChamberOfCommerceService.java
/src/ChamberOfCommerceServiceImpl.java


copy CoCPortTypeImpl.java to src-generated/


>>deploy-wsdl

and start ServiceMix
$ ESB/apache-servicemix-3.3/bin/servicemix


How to test ServiceMix
soapui
start
$ bin/soapui.sh


new project
insert : project name
select wsdl file :

You can request from findCompanies > Request 1.

you can also see from a serviceMix console.

ref : mdailey

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

[ AI ] IBM granite, NVIDIA robotics, IBM Langflow, watsonx, LMCache, LiteRT, Self driving car, Mamba model, RAG

 IBM granite: Time series from sensor, stock market * Forcast * Anomaly detection - classification high medium risk, data synthesis Embedding AI - 1M params - edge device - small AI Send insight --- NVIDIA * Jackson Thor robotic * Nemo ---- * IBM Langflow : open source * Watsonx (n8n) Enterprise : guardrails / log, tool using policy ----- LMcache : open source KC cache Prompt -> key value (RAGs) Same context ( e.g. same docs) Reduce operating costs CacheGen : make cache cheap to move and store CacheBlend : reuse chunk, not just prefix ---- Google มี framework ที่ optimize AI บน mobile phone นั่นคือ LiteRT : google pytorch Quantisation เท่าไหร่บน device นี้ Model explorer: quantize แล้ว error < 5% XMNpack ใช้ CPU ลดลง Google AI edge portal : benchmark AI on real device ---- Self driving car * Nvidia Alpamayo 2 model * Carla simulation Random forest -> multiple scenarios -> json -> LLM Car talk to mobile phone (cross the road) ----- Mamba model (recursive)  - alte...

ส่งไปรษณีย์ทีละมากๆ ที่ช่องไปรษณีย์สำหรับธุรกิจ

  ถ้าเราส่งไปรษณีย์ทีละ 10 กล่องขึ้นไป สามารถไปส่งโดยใช้ช่องทางธุรกิจได้ โดยต้องกรอกใบรับฝากรวม ( Receipt for bulk Posting ) เป็นลิสต์รายการให้เขาไปด้วย โดยกรอกพัสดุแต่ละรายการ และ ไปยื่นให้เขาพร้อมกับพัสดุที่จะส่ง วิธีกรอก คือ ให้กรอกพัสดุแบบเดียวกันไว้แผ่นเดียวกัน  เช่น พัสดุ10 กล่อง กล่องขนาดเท่ากัน น้ำหนักเท่ากันหมด กรอกไว้ 1 แผ่น ถ้าน้ำหนักต่างกัน ขนาดกล่องต่างกัน กรอกแยกแผ่นไว้ดีที่สุด ซึ่งใบนี้สามารถไปขอได้ที่ไปรษณีย์ฝ่ายธุรกิจ สามารถนำมาทำใส่ A4 ก็ได้ ขอบคุณคุณพี่ amarin.ch ที่ไปรษณีย์กลาง ( BANGKOK G.P.O. ) มากๆ นะครับ สำหรับคำแนะนำ ขอบคุณที่ช่วยคีย์ให้ทีละรายการสำหรับมือใหม่ที่ยังไม่รู้ว่ามีใบรับฝากรวมอย่างผมด้วยครับ คราวหน้าผมจะทำใบรับฝากรวมไปครับ

อยู่เหงาๆ เราไปเที่ยว - ไหว้พระขอพร ศาลเจ้าแม่ทับทิม (อาม่า), เจริญกรุง, กรุงเทพ; 天后聖母廟, 石龙軍路, 曼谷, 泰国; Thap Thim Chinese Goddess Shrine, Chareon Krung 63 Road, Bangkok, Thailand

天后聖母廟, 石龙軍路, 曼谷, 泰国 ไหว้ศาลเจ้าแม่ทับทิม ขอให้การค้าเจริญรุ่งเรือง ตำนานเจ้าแม่ทับทิมเกิดที่ตำบลตุ้ยบ๊วย เขตบ่นเซียว เกาะไหหลำ มีผู้เฒ่าแซ่พัว เป็นผู้มีความซื่อสัตย์สุจริต ทำงานขยันขันแข็ง ครั้งหนึ่งแกออกไปหาปลา โดยผูกแหเป็นช้อนดักปลา เวลาผ่านไปแกยังหาปลาไม่ได้ คืนนั้นก็ประสบความล้มเหลว เมื่อช้อนแหขึ้นมาทีไรก้อมีแต่ท่อนไม้ ด้วยความโมโหแกเลยขว้างท่อนไม้นั้นออกไปให้ไกล แต่แล้วเมื่อช้อนแหขึ้นมาใหม่ก็ปรากฏท่อนไม้ท่อนเดิมอีก ต่อจากนั้นแกก็ขว้างท่อนไม้ขึ้นฝั่ง และแกก็ฉุก คิดว่าแปลกที่ท่อนไม้ธรรมดาจะสามารถลอยทวนน้ำได้ คงจะเป็นสิ่งวิเศษ และแกก็ได้นำท่อนไม้นั้นขึ้นฝั่ง และเพ่งมองท่อนไม้นั้นพร้อมกับอธิษฐานว่า หากท่อนไม้นี้มีความศักดิ์สิทธิ์ขอให้คืนนี้จับปลาได้มาก เมื่อพ้นจากความจนแล้ว เมื่อขึ้นฝั่งจะนำท่อนไม้นี้แกะสลักเป็นเทวรูปศักดิ์สิทธิและสักการะบูชาเช้าวันไม่ให้ขาด เมื่ออธิษฐานจบแกเอาท่อนไม้นั้นวางบนหัวเรือ ปรากฏว่าช้อนเพียงสองถึงสามครั้งก็ได้ปลาตัวโตเต็มเรือ จึงนำปลาขึ้นฝั่งวันนั้นปลาของแกขายได้ราคา เพราะชาวประมงคนอื่นจับได้น้อยแกจึงมีเงินจับจ่ายใช้สอย และทุกครั้งที่แกออกหาปลา ...

แนะนำ ยาบำรุงครรภ์ จับซาไท้เป้า หรือ 13 องครักษ์พิทักษ์ครรภ์ ยาจีน บำรุงครรภ์

จับซาไท้เป้า  ยาบำรุงครรภ์ สมุนไพรจีน ช่วงนี้เพื่อนๆ เริ่ม ทยอย แต่งงาน กันแล้ว นะครับ เราเองก็มียาจีนมา นำเสนอ ซึ่งเป็น ยาดี ที่คุณแม่ ของเรา ทาน ตอนคลอดเรา นั่นก็คือ "จับซาไท้เป้า" ยาบำรุงครรภ์ นั่นเอง เงง เงง เงง เงง จับซาไท้เป้า เป็น ยาจีน ซึ่ง ประกอบไปด้วย สมุนไพร จีน 13 อย่างด้วยกัน มี สรรพคุณ เป็น ยาบำรุงครรภ์ บำรุง ทั้งคุณแม่ และ คุณลูก เลย เรียกได้ว่า สรรพคุณ ครบครัน บำรุง คุณแม่ ช่วงตั้งท้อง ช่วยให้ คุณลูก แข็งแรง มีผิวพรรณ สะอาดสะอ้าน ในตอนที่คลอดออกมา จะ คลอดง่าย ตัวจะไม่มีคราบไขมันติดเยอะ จ้า วิธีกินจับซาไท้เป้า ทานตั้งแต่ท้อง 5 เดือนขึ้นไป 2 อาทิตย์ทาน 1 ห่อ ทานจนคลอด ศิริรวมแล้ว ถ้าทาน ครบ dose โดยเริ่มตั้งแต่ 5 เดือน ต้องทานทั้งหมด 10 ห่อ จ้ะ วิธีต้มจับซาไท้เป้า  1 ห่อ ต้มได้ 2 ครั้ง ครั้งแรก ใส่น้ำ 3 ถ้วย ต้มเหลือ 8/10 ถ้วย ครั้งที่ 2 ใส่น้ำ 2.5 ถ้วย ต้มเหลือ 7/10 ถ้วย ซื้อที่ไหนดี หลายๆ คน มักจะมีคำถาม ว่า จับซาไท้เป้า ซื้อที่ไหน  ซึ่งเราเอง แนะนำร้านขาย จับซาไท้เป้า ซึ่งก็คือ ร้าน ขายยา ย่ง เช...

EJB development ด้วย Glassfish Server -- Part 2 ( Create a project )

สร้าง project สำหรับ EJB module สร้าง EJB project ชื่อว่า titan-ejb เลือก Target Runtime : Glassfish คลิกขวาที่ Project ติ๊ก JPA facet, และ configure JPA facet ให้ใช้ connection profile ที่สร้างไว้แล้ว >>>>>>>>>>>>>>>>>>> วิธีสร้าง JPA Entity: - คลิกขวาที่ Project Explorer - New->Class ชื่อ com.titan.domain.Cabin implement java.io.Serializable [ Serializable คือ สามารถ convert class to String แล้วส่งไปที่ network ได้ ] วิธีสร้าง implement class บน eclipse มันก็จะสร้างฟังก์ชั่นโบ๋ๆ มาให้ package com.titan.domain; import java.io.Serializable; public class Cabin implements Serializable { } - Add the fields static final long serialVersionUID = 1L; private int id; private String name; private int deckLevel; private int shipId; private int bedCount; - สร้าง getters and setters สำหรับ id, name, deckLevel, shipId, and bedCount. [ ใน eclipse ง่ายมาก ไปที่ Source > Generate setters and getters ( หรือ คลิกขวาตรงที่เขียนโค้ด So...

เฉินหลงฟัดในปี 2025 The Shadow's Edge

เริ่มดูเพราะ ฉากในลิฟต์ ที่เด้งมาใน tiktok เลยรู้สึกว่า หนังดูมีอะไรจังวะ  พอดูจริงๆ หนังมีอะไรอย่างที่คิดไว้ แม้ตอนแรกๆ ตอนปล้น อาจจะให้ความรู้สึกเหมือน Now You See Me ไปบ้าง แต่หนังมีความสนุก มีอารมณ์ความรู้สึก  มีการใส่เทคโนโลยีใหม่ๆ อย่าง เทคโนโลยีคล้ายๆกับของ Peter Theil แต่ก็ทำงานร่วมกับคนรุ่นเก่าอย่างเฉินหลงได้อย่างดี มีการสร้างตัวร้ายที่เก่งสมน้ำสมเนื้อ  และ ทิ้งท้ายว่า จะมีภาคต่ออีกต่างหาก ชอบประโยคที่ว่า "นายต้องจบงานเองได้"

กระแส AI อุตสาหกรรมอะไรดีบ้าง

กระแส AI Super Cycle ไม่ได้ส่งผลดีแค่กับคนทำซอฟต์แวร์ แต่กำลัง "ยกแผง" อุตสาหกรรมโครงสร้างพื้นฐาน (Infrastructure) ทั้งหมด โดยเฉพาะ 3 กลุ่มหลัก ดังนี้ครับ: 1. อุตสาหกรรมพลังงาน (Energy & Utilities) AI คือ "จอมเขมือบไฟ" ทำให้บริษัทที่ทำระบบผลิตไฟฟ้าและจัดการพลังงานกลายเป็นพระเอกใหม่ โดยเปลี่ยนจากพลังงานแบบเดิมมาเป็นเทคโนโลยีที่สะอาดและเสถียรมากขึ้น สิ่งที่ดีขึ้น: มีการนำเทคโนโลยี Fuel Cell มาใช้ผลิตไฟฟ้าโดยไม่ผ่านการเผาไหม้ เพื่อตอบโจทย์ Data Center ที่ต้องรัน 24 ชม. ตัวอย่าง: Bloom Energy (BE): ใช้ระบบ Solid-oxide Fuel Cell เปลี่ยนก๊าซเป็นไฟฟ้าให้ Oracle แบบ 100% ในโปรเจกต์ยักษ์ Delta Electronics: กลายเป็นตัวตึงด้านระบบจัดการพลังงานที่กำไรทุบสถิติประวัติศาสตร์ 2. อุตสาหกรรมฮาร์ดแวร์และเซมิคอนดักเตอร์ (Hardware & Supply Chain) เมื่อ AI ต้องประมวลผลมหาศาล อุปกรณ์เบื้องหลังจึงต้อง "อัปเกรด" ขนานใหญ่ จนเกิดสภาวะ "คนขายเป็นใหญ่" (Seller's Market) สิ่งที่ดีขึ้น: ความต้องการชิ้นส่วนเฉพาะทางพุ่งสูงขึ้นอย่างก้าวกระโดด ทั้งแผ่นรองชิป, หน่...

20 th century boys movie ( 20世紀少年, Nijisseiki Shōnen )

โอ ว้าววว มีภาคโ รงหนังด้วย เห็นเขาว่า ทำเป็น 3 ภาค ภาคแรก ฉาย 30 สิงหาคม 2008 นี้แล้ว ถ่ายใน 7 ประเทศ ซึ่งแน่นอนว่า ต้องมีประเทศไทยด้วยแน่นอน theme song “20th Century Boy” ร้องโดย วงร๊อกอังกฤษ T.Rex ดูหน้าคนเล่นกันดีกว่า casting เอ็นโด เคนจิ แสดงโดย Toshiaki Karasawa โอตโจะ แสดงโดย Etsushi Toyokawa ยูคิจิ แสดงโดย Takako Tokiwa โยชิสึเนะ แสดงโดย Teruyuki Kagawa มารุโอะ แสดงโดย Hidehiko Ishizuka เคโรยอน แสดงโดย Hiroyuki Miyasako ดองกี้ แสดงโดย Katsuhisa Namase ยามาเนะ แสดงโดย Fumiyo Kohinata ฟุคุเบ แสดงโดย Kuranosuke Sasaki มันโจเมะ อินชู แสดงโดย Renji Ishibashi พระเจ้า เอ็นโด คิริโกะ แสดงโดย Hitomi Kuroki มาซาโอะ ทามุระ แสดงโดย ARATA มอนจัง แสดงโดย Takashi Ukaji แม่ของเคนจิ นักแสดงอื่นๆอีก ตัวละคร 300 กว่าตัว Match หน้ากับชื่อ ไม่ถูกกันเลยทีเดียว Nana Katase - Mika Shikishima Chizuru Ikewaki - part-time worker Erika Mirai Moriyama - mangaka Kameda Yu Tokui - convenience store employee Miyako Takeuchi - Setsuko Ichihara Yoriko Doguchi - Mitsuko Kido Kenichi Endo - bloody man Ke...

รีวิว: Human Resource พนักงานใหม่โปรดรับไว้พิจารณา สปอยแหลก

a.k.a. ชนแม่งเลย หนังเป็น พี่เต๋อ ที่พร้อมจะหักมุมตลอดเวลา คาดเดาอะไรไม่ได้เลย หนังที่คิดว่าเป็นหนังคนทำงาน ดันมีฉาก เรท R มาเฉย ได้ข้อคิด แต่ไม่ได้ชอบมาก เพราะ ประเทศที่พัฒนาแล้วจะไม่มาคิดเรื่องพวกนี้เลยสักนิด  ถ้าตอนนี้ไปดูประเทศสหรัฐ (ที่กำลังบูมเรื่อง AI) ประเทศจีน (ตามมาติดๆ หรือนำไปแล้ว?) ประเทศ ไต้หวัน (ที่กำลังบูมเรื่อง เซมิคอนดักเตอร์) ประเทศเกาหลี (แซมซัง ก็ไล่มาติดๆ) ประเทศเวียดนาม (ที่ต่างชาติไปลงทุนมากๆ) จะไม่มีคำถามอะไรพวกนี้ในสมองเลย ลองไปฟังวิทยุช่องจีน ในเมืองที่เจริญๆ เมืองเศรษฐกิจ จะมีแต่ภาพ อนาคต ความหวัง ของใหม่ โรงงานใหม่ วิธีทำงานแบบใหม่ positive กว่ามาก ถ้ามัวแต่คิดเหมือนที่หนังปูในตอนแรก จะทำให้เรา ตกอยู่ใน loop นรก ซึ่งยิ่งคิดยิ่งแย่ แย่จนไม่คิดจะลงมือทำอะไรเลย เพราะจิตเป็นนายกายเป็นบ่าว สื่อ อย่าไปออกเรื่องไม่ดีมาก ออกเรื่องดีๆบ้าง เดี๋ยวคนในประเทศหวาดกลัวจนไม่กล้าทำอะไร ถึงตอนนั้นก็แย่ของจริง ตอนนี้คนประเทศอื่น ทำหนังลง Netflix กันเยอะนะครับ มีหนังใหม่ๆ ของประเทศอื่นเต็มไปหมด เช่น ฝรั่งเศส เยอรมัน สหรัฐ เกาหลี  บางอันก็ดัง บางอันก็ไม่รู้จัก