colorado software summit: october 24 – 29, 2004...

43
Colorado Software Summit: October 24 – 29, 2004 © Copyright 2004, IBM Corporation Paul Fremantle — Using Web Services to Access Legacy C/C++ Code from Java Page 1 Using Web Services to Access Legacy C/C++ Code from Java Paul Fremantle Senior Technical Staff Member IBM Hursley Park

Upload: doanque

Post on 11-Mar-2018

214 views

Category:

Documents


1 download

TRANSCRIPT

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 1

Using Web Services to Access Legacy CC++ Code from JavaPaul FremantleSenior Technical Staff MemberIBM Hursley Park

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 2

Who Am IpzfukibmcomLead development architect for

IBMrsquos Web Services GatewayCC++ Web Services Toolkit

Co-author of Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition) ndash an excellent book about WSinJThis session will cover the use of Apache Axis in Java and CC++ to enable legacy integration

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 3

ContentsWhat is the problemReal scenariosExisting other solutionsAxis JavaAxis CC++Example ndash C++ calling Java servicesExample ndash Java calling C++ ServicesPerformanceStill to doFutures

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 4

ProblemsThere are a large number of existing CC++ applications

Typically resource pressure means rewriting these is not an optionAlso some applications would not benefit from rewriting in Java ndash especially computationally intensive processing appsbull Market analysisbull eScience applicationsbull Restricted environments

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 5

Service Oriented ArchitectureThe fundamental premise

A service consumer doesnrsquot care how the service is implemented ndash only what it offers

Common interoperable interface defined in XML and Schema

SOAP provides the communication protocolWSDL provides the information on the service interface and locationUDDI provides a global or local directory of services and additional metadata

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 6

Scenarios 1Online services

BackendServicesBackend

ServicesBackendServices

Java Web AppServers

Existing C++applications

Load balancerLoad balancer

Load balancer

Java Web AppServers

Existing C++applications

Re-architecting multi-tier computing based onopen standards

High performance high scalability

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 7

Scenarios 2Client Server enhancement

Existing C++ client

Java-based workflow application

Initiateprocess

C++ Server

Enhancing existing client-server Integrating into an enterprise workflow

system

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 2

Who Am IpzfukibmcomLead development architect for

IBMrsquos Web Services GatewayCC++ Web Services Toolkit

Co-author of Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition) ndash an excellent book about WSinJThis session will cover the use of Apache Axis in Java and CC++ to enable legacy integration

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 3

ContentsWhat is the problemReal scenariosExisting other solutionsAxis JavaAxis CC++Example ndash C++ calling Java servicesExample ndash Java calling C++ ServicesPerformanceStill to doFutures

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 4

ProblemsThere are a large number of existing CC++ applications

Typically resource pressure means rewriting these is not an optionAlso some applications would not benefit from rewriting in Java ndash especially computationally intensive processing appsbull Market analysisbull eScience applicationsbull Restricted environments

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 5

Service Oriented ArchitectureThe fundamental premise

A service consumer doesnrsquot care how the service is implemented ndash only what it offers

Common interoperable interface defined in XML and Schema

SOAP provides the communication protocolWSDL provides the information on the service interface and locationUDDI provides a global or local directory of services and additional metadata

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 6

Scenarios 1Online services

BackendServicesBackend

ServicesBackendServices

Java Web AppServers

Existing C++applications

Load balancerLoad balancer

Load balancer

Java Web AppServers

Existing C++applications

Re-architecting multi-tier computing based onopen standards

High performance high scalability

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 7

Scenarios 2Client Server enhancement

Existing C++ client

Java-based workflow application

Initiateprocess

C++ Server

Enhancing existing client-server Integrating into an enterprise workflow

system

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 3

ContentsWhat is the problemReal scenariosExisting other solutionsAxis JavaAxis CC++Example ndash C++ calling Java servicesExample ndash Java calling C++ ServicesPerformanceStill to doFutures

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 4

ProblemsThere are a large number of existing CC++ applications

Typically resource pressure means rewriting these is not an optionAlso some applications would not benefit from rewriting in Java ndash especially computationally intensive processing appsbull Market analysisbull eScience applicationsbull Restricted environments

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 5

Service Oriented ArchitectureThe fundamental premise

A service consumer doesnrsquot care how the service is implemented ndash only what it offers

Common interoperable interface defined in XML and Schema

SOAP provides the communication protocolWSDL provides the information on the service interface and locationUDDI provides a global or local directory of services and additional metadata

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 6

Scenarios 1Online services

BackendServicesBackend

ServicesBackendServices

Java Web AppServers

Existing C++applications

Load balancerLoad balancer

Load balancer

Java Web AppServers

Existing C++applications

Re-architecting multi-tier computing based onopen standards

High performance high scalability

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 7

Scenarios 2Client Server enhancement

Existing C++ client

Java-based workflow application

Initiateprocess

C++ Server

Enhancing existing client-server Integrating into an enterprise workflow

system

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 4

ProblemsThere are a large number of existing CC++ applications

Typically resource pressure means rewriting these is not an optionAlso some applications would not benefit from rewriting in Java ndash especially computationally intensive processing appsbull Market analysisbull eScience applicationsbull Restricted environments

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 5

Service Oriented ArchitectureThe fundamental premise

A service consumer doesnrsquot care how the service is implemented ndash only what it offers

Common interoperable interface defined in XML and Schema

SOAP provides the communication protocolWSDL provides the information on the service interface and locationUDDI provides a global or local directory of services and additional metadata

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 6

Scenarios 1Online services

BackendServicesBackend

ServicesBackendServices

Java Web AppServers

Existing C++applications

Load balancerLoad balancer

Load balancer

Java Web AppServers

Existing C++applications

Re-architecting multi-tier computing based onopen standards

High performance high scalability

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 7

Scenarios 2Client Server enhancement

Existing C++ client

Java-based workflow application

Initiateprocess

C++ Server

Enhancing existing client-server Integrating into an enterprise workflow

system

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 5

Service Oriented ArchitectureThe fundamental premise

A service consumer doesnrsquot care how the service is implemented ndash only what it offers

Common interoperable interface defined in XML and Schema

SOAP provides the communication protocolWSDL provides the information on the service interface and locationUDDI provides a global or local directory of services and additional metadata

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 6

Scenarios 1Online services

BackendServicesBackend

ServicesBackendServices

Java Web AppServers

Existing C++applications

Load balancerLoad balancer

Load balancer

Java Web AppServers

Existing C++applications

Re-architecting multi-tier computing based onopen standards

High performance high scalability

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 7

Scenarios 2Client Server enhancement

Existing C++ client

Java-based workflow application

Initiateprocess

C++ Server

Enhancing existing client-server Integrating into an enterprise workflow

system

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 6

Scenarios 1Online services

BackendServicesBackend

ServicesBackendServices

Java Web AppServers

Existing C++applications

Load balancerLoad balancer

Load balancer

Java Web AppServers

Existing C++applications

Re-architecting multi-tier computing based onopen standards

High performance high scalability

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 7

Scenarios 2Client Server enhancement

Existing C++ client

Java-based workflow application

Initiateprocess

C++ Server

Enhancing existing client-server Integrating into an enterprise workflow

system

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 7

Scenarios 2Client Server enhancement

Existing C++ client

Java-based workflow application

Initiateprocess

C++ Server

Enhancing existing client-server Integrating into an enterprise workflow

system

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 8

Scenario 3

Existing Custom

Transaction server

Java Web ApplicationServer

WebSvc

enabler

Providing simple access to legacy transaction enginesand custom servers

Web refacing of client server systems

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 9

Scenario 4

CC++Windows

appJavaJ2EE application

Accessing Java server business logic from a CC++ windows application

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 10

Other ApproachesJNI ndash Java Native Interface

Good for a single machine single process modelDifficult to scale or distributeUnpleasant development model

CORBAJPH = Just Plain Hard

JCA connectorsProvide legacy system connectors for systems such as CICS IMS SAP etcGood when they exist but hard to createLatest specification supports both

bull Outbound (Java legacy) and bull Inbound (legacy Java)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 11

What Is AxisAn open source project in the Apache Software Foundation to provide high-quality SOAP engines in Java and CC++

Operated on a ldquomeritocracyrdquoThe more you do the more responsibility you obtainCommitters are active members on the project who have access to commit code to the repositoryJava project made its first alpha available Aug 2001

bull Came out of Apache SOAP project initially donated by IBMC++ project made its first alpha available Dec 2003

bull Came out of an initiative from a team in Sri Lanka ndash Lanka Software Foundation

bull httpwwwopensourcelk

see httpwwwmanageabilityorgblogstuffmost-valuable-personalities-in-java

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 12

What Is a SOAP EngineMain functions are

Requester-sidebull Provide stubs or a dynamic invocation interface (DII)bull Map local language objectsparameters to SOAP XML messages

vice-versabull Send those XML messages over a transport (HTTP)

Provider-sidebull Take SOAP messages and invoke local language objects or

methodsbull Listen on a transport (HTTP) and plug-in to existing HTTP

servers (Apache)Tooling

bull Take WSDL and generate stubs and skeletons bull (take existing language artefacts and generate WSDL)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 13

Overview of Axis JavaClient app

GetQuote(generated stub)

Axisjar

Call

Tomcat

ApacheHTTP

SimpleAxis

Server

Axisjar engine

QuotegetQuote

JavaProvider

getQuote

SOAPHTTPSOAPHTTPS

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 14

AxisClientdll

Overview of Axis CC++

clientapplication

GetQuote(generated)

Call

SOAPHTTPSOAPHTTPS

SimpleAxisServer

Axis_mod

ApacheHTTP

AxisServerdll

GetQuoteWrapper(generated)

getQuote()

GetQuote(generated skeleton)

getQuote()

Either side may be an alternative implementation

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 15

What Is Axis CC++The main components are

AxisClientdllbull The client code library

AxisServerdllbull The server code library

AxisTransportdllbull The HTTP transport library

WSDL2WSbull A tool for generating stubs and skeletons from WSDLbull Notehellip This is written in Java so requires a JRE to run

mod_axisdll mod_axis2dllbull Apache HTTP 1x 2x modules that link to AxisServerdll

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 16

A Simple ExampleThe Quote service is sort of the Hello World of Web Services

GetQuotewsdlltmessage name=testRequestgt

ltmessage name=testResponsegtltpart name=testResult type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteRequestgtltpart name=symbol type=xsdstringgt

ltmessagegt

ltmessage name=GetQuoteResponsegtltpart name=result type=xsdfloatgt

ltmessagegt

lt-- Interface --gtltportType name=GetQuotegt

ltoperation name=getQuote gtltinput message=tnsGetQuoteRequestgtltoutput message=tnsGetQuoteResponsegt

ltoperationgtltoperation name=test gt

ltinput message=tnstestRequestgtltoutput message=tnstestResponsegt

ltoperationgtltportTypegt

This defines one interface with two methods

ldquopublic String test()rdquo

ldquopublic float getQuote(String)rdquo

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 17

Client Side ndash C++CLASSPATH=

[path]WSDL2Wsjar[path]axisjar[path]commons-discoveryjar[path]commons-loggingjar[path]jaxrpcjar[path]log4j-128jar[path]saajjar[path]wsdl4jjar

java orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl ndashsclient ndashlc++

getQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampfloatLanguageName Output Parameter type Name floatxsd__stringLanguageName Output Parameter type Name xsd__stringCcppwinGetQuotecpp createdCcppwinGetQuoteh createdfaultInfoName isClientCcppwinAxisClientExceptionh createdCcppwinAxisClientExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 18

Client GetQuotehinclude ltaxisclientStubhgtinclude AxisClientExceptionhinclude ltaxisISoapFaulthgt

class GetQuote public Stubpublic

GetQuote(const char pchEndpointUri AXIS_PROTOCOL_TYPE eProtocol=APTHTTP)GetQuote()

publicvirtual ~GetQuote()

public float getQuote(xsd__string Value0)xsd__string test()int getFaultDetail(char ppcDetail)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 19

Example Client Codeint main(int argc char argv[])

char endpoint[256]const char server=localhostconst char port=80

char pcDetail

xsd__string symbol = IBMsprintf(endpoint httpssaxisCalculator server port)

GetQuote quote(endpoint)try

float fResult = quotegetQuote(symbol)printf(ldquoResult fnrdquo fResult)

catch(AxisExceptionamp e)

printf(Exception sn ewhat())

return 0

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 20

Java Client Side (for comparison)set classpath=

liblibaxisjarlibcommons-discoveryjarlibcommons-loggingjarlibjaxrpcjarliblog4j-128jarlibsaajjarlibwsdl4jjar

java orgapacheaxiswsdlWSDL2Java GetQuotewsdl -vParsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjava

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 21

GetQuotejavapackage xmltoday_delayed_quotes

public interface GetQuote extends javarmiRemote public float getQuote(javalangString symbol) throws javarmiRemoteExceptionpublic javalangString test() throws javarmiRemoteException

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 22

Server Side C++Same classpath as C++ client

gtjava orgapacheaxiswsdlwsdl2wsWSDL2Ws GetQuotewsdl -sservergetQuoteoperation name ampampampampampampampampampampamptestoperation name ampampampampampampampampampampampCcppwinGetQuoteWrappercpp createdCcppwinGetQuoteWrapperh createdCcppwinGetQuotecpp createdCcppwinGetQuoteh createdCcppwinGetQuoteServicecpp createdfaultInfoName isServiceCcppwinAxisServiceExceptionh createdCcppwinAxisServiceExceptioncpp created

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 23

GetQuote Skeletoninclude GetQuoteh

GetQuoteGetQuote()

GetQuote~GetQuote()

void GetQuoteonFault()

void GetQuoteinit() void GetQuotefini()

float GetQuotegetQuote(xsd__string Value0)

xsd__string GetQuotetest()

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 24

Java Server-sidegtjava orgapacheaxiswsdlWSDL2Java GetQuotewsdl --server-side -v

Parsing XML file GetQuotewsdlGenerating xmltoday_delayed_quotesGetQuoteServicejavaGenerating xmltoday_delayed_quotesGetQuoteServiceLocatorjavaGenerating xmltoday_delayed_quotesGetQuotejavaGenerating xmltoday_delayed_quotesGetQuoteBindingStubjavaGenerating xmltoday_delayed_quotesGetQuoteBindingImpljavaGenerating xmltoday_delayed_quotesdeploywsddGenerating xmltoday_delayed_quotesundeploywsdd

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 25

GetQuoteBindingImplpackage xmltoday_delayed_quotes

public class GetQuoteBindingImpl implements xmltoday_delayed_quotesGetQuote

public float getQuote(javalangString symbol) throws javarmiRemoteException

return -3

public javalangString test() throws javarmiRemoteException return null

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 26

WSDD FilesWeb Services Deployment Descriptor

Configuration and deployment data required

Server-side The implementation classConfiguration propertiesHandlers (explained later)

Client side (optional)Handlers

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 27

Deploywsdd C++ltxml version=10 encoding=UTF-8gtltdeployment xmlns=httpxmlapacheorgaxiswsdd

xmlnsCPP=httpxmlapacheorgaxiswsddprovidersCPPgtltservice name=GetQuoteService provider=CPPRPC description=Axis C++ web servicegt

ltparameter name=className value=userlocalapacheaxisGetQuoteServicesogtltparameter name=allowedMethods value=getQuote test gt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 28

Deploywsdd Javaltdeployment

xmlns=httpxmlapacheorgaxiswsddxmlnsjava=httpxmlapacheorgaxiswsddprovidersjavagt

ltservice name=GetQuote provider=javaRPC style=rpc use=encodedgtltparameter name=wsdlTargetNamespace value=urnxmltoday-delayed-quotesgtltparameter name=wsdlServiceElement value=GetQuoteServicegtltparameter name=wsdlServicePort value=GetQuotegtltparameter name=className value=xmltoday_delayed_quotesGetQuoteBindingImplgtltparameter name=wsdlPortType value=GetQuotegtltoperation name=getQuote qname=operNSgetQuote xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=result returnType=rtnsfloat xmlnsrtns=httpwwww3org2001XMLSchema gtltparameter name=symbol type=tnsstring xmlnstns=httpwwww3org2001XMLSchemagt

ltoperationgtltoperation name=test qname=operNStest xmlnsoperNS=urnxmltoday-delayed-quotes returnQName=testResult returnType=rtnsstring xmlnsrtns=httpwwww3org2001XMLSchema gtltoperationgtltparameter name=allowedMethods value=getQuote testgt

ltservicegtltdeploymentgt

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 29

Contract FirstSo far the work has all been WSDL Java C++Axis Java also supports Java2WSDL

Creates schema based on Java Types

Axis CC++ does not yet have thisIssues around too many (void )

So for exposing C++ objects server side you must create a WSDL first

This is called ldquoContract-FirstrdquoA lot of good people believe in this

bull httppluralsightcomblogsaaronarchive200408272092aspxbull httpwwwgotdotnetcomteamdboxdefaultaspxkey=2004-08-31T015405Z

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 30

How Do I Create a WSDL1 If you are a Java programmer you can cheat

Create a Java interface and run Java2WSDL on it

2 If you are an XML Schema programmer (can I hire you ndash you must be smart)

Write the WSDL using notepad vi emacs

3 Use a WSDL editing toolWebSphere Studio XML Spy

4 Use an alternative SOAP toolkit to create the WSDL

gSOAP

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 31

Using UDDIUDDI adds a level of ldquovirtualisationrdquo to the model

The actual target endpoints donrsquot have to be defined in the client codeThe client does a lookup into UDDI and sets the correct endpoints

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 32

UDDI

server

service

UDDI

1a deploy

1b publish

requester

2a inquire

2b invoke

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 33

How to Use UDDIWith Java use UDDI4J

httpUddi4jorg

C++ compile the WSDLs using WSDL2WShttpuddiorgwsdlinquire_v2wsdlhttpuddiorgwsdlpublish_v2wsdlOr similar v3 WSDLs available from UDDIorg

Stub method bull void AXISCALL setEndPoint(const char pcEndPointURI)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 34

Issues with the Current Axis Codebase

Java12 alpha at the time of writingPretty stable and solid

bull Really a 2x release as Apache SOAP was the 1x codebase

Used in a number of products as the SOAP enginebull eg IBM WebSphere uses a heavily enhanced version

CC++13 alpha at the time of writingMore like a 1x codebaseC++ is usable C is less well tested and stretched

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 35

SOAP HREFsltsoapenvBodygtltns1echoIntegerResponsegt

ltreturn href=id0gtltns1echoIntegerResponsegtltmultiRef id=id0gt42ltmultiRefgtltsoapenvBodygt

Produced by Axis Java when using ENCODED (SOAP encoding)ltparameter name=sendMultiRefs value=ldquofalsegt --- turns off

NOT SUPPORTED by Axis C++

WhyWS-I does not support SOAP encoding

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 36

HandlersHandlers allow direct access to the SOAP message to perform additional processing

Key to implementing the SOAP processing modeleg WS-Addressing WS-SecurityAlso can perform routing or logging

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 37

Handlersinclude ltaxisserverHandlerhgt

AXIS_CPP_NAMESPACE_USE

class THandler public Handlerpublic

int AXISCALL fini()int AXISCALL init()void AXISCALL onFault(void pvIMsg)int AXISCALL invoke(void pvIMsg)void setOptionList(const mapltstring stringgt OptionList)const stringamp getOption(const stringamp sArg)THandler()virtual ~THandler()

protectedstring m_sEmpty

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 38

PerformanceLimited performance results available (Thanks to AlekSlominski)

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 39

FuturesAxis Java 1x is being stabilised and work is starting on Axis Java 20

httpwikiapacheorgwsFrontPageAxis2Axis CC++ 14 will be next release

Aimsbull Improved memory allocationbull Cleaner separation of C and C++ to provide a cleaner

memory modelbull Better support for threadingbull Continuous improvement of support for

WSDLSchema variants

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 40

Futures (Continued)

Axis 20 design is common between C++ and Java

Aim to start on C++ once 1x has stabilised and is useful

Performance should be very fasthellipType Specific Pull Parser

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 41

Pull ParsersDOM

Read complete document into memory

SAXRegister event handlers with parser called back as each new element is handled

Pull Ask for each new event in a stream

Typed PullAsk for next Integer Long etc

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 42

More InformationAxis homepage

httpwsapacheorgaxis

Pull parsershttpxmlpullorg

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418

Colorado Software Summit October 24 ndash 29 2004 copy Copyright 2004 IBM Corporation

Paul Fremantle mdash Using Web Services to Access Legacy CC++ Code from Java Page 43

ResourcesIBM developerWorks WebServices Zone

httpwwwibmcomdeveloperworkswebservicesAll the IBM MS standards

ldquoThe Hidden Impact of WS-Addressingrdquohttpwww-106ibmcomdeveloperworkswebserviceslibraryws-addresshtml

Building Web Services with Java Making Sense of XML SOAP WSDL and UDDI (2nd Edition)Publisher Pearson Education ISBN 0672326418