Create a Web Services Consumer for the Stock Quote Service
You can create a Web services consumer for the Stock Quote service in Sterling B2B Integrator.
About this task
Procedure
- Check-in the WSDL.
For more information, see Check In a WSDL for a Web Service.
- Create a business process named
StockQuoteConsumer.bp
:- Create an entry in the GPM pallet corresponding to the checked-in WSDL, which can be used while writing the business process.
- Use the following “assign” statements and “DomToDoc”
service to create a primary document for the execution of the business
process:
<assign to="stockin:symbol">GISSC</assign> <assign to="stockin:GetQuote" from="//*[namespace-uri()='http://www.webservice.stockquotein' and local-name()='symbol']"/> <assign to="Root" from="//*[namespace-uri()='http://www.webservice.stockquotein' and local-name()='GetQuote']"/> <assign name="Assign" to="." from="DOMToDoc(/ProcessData/Root,'PrimaryDocument')"> </assign>
- Add the following lines in the
namespaces.properties
file:stockout=http://www.webservice.stockquoteout
stockin=http://www.webservice.stockquotein
The complete business process (including the input document) is as follows:<process name="StockQuoteConsumerBP"> <sequence> <assign to="stockin:symbol">GRGSC</assign> <assign to="stockin:GetQuote" from="//*[namespace-uri()='http://www.webservice.stockquotein' and local-name()='symbol']"/> <assign to="Root" from="//*[namespace-uri()='http://www.webservice.stockquotein' and local-name()='GetQuote']"/> <assign name="Assign" to="." from="DOMToDoc(/ProcessData/Root,'PrimaryDocument')"></assign> <assign name="Assign" to="GetQuote" from="//PrimaryDocument/@SCIObjectID"></assign> <operation name="executeStockQuoteBP"> <participant name="DS_STOCKQUOTEWEBSERVICE_PORT1_OPE1_Instance"/> <output message="DS_STOCKQUOTEWEBSERVICE_PORT1_OPE1InputMessage"> <assign to="." from="*"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="SOA Outbound Message Processing Service"> <participant name="SOAOutboundMsgProcessingService_Instance"/> <output message="SOAOutboundMsgProcessingTypeInputMessage"> <assign to="." from="*"></assign> <assign to="ADD_SOAP_ENVELOPING">true</assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="HTTP Client Begin Session Service"> <participant name="HTTPClientBeginSession"/> <output message="HTTPClientBeginSessionServiceTypeInputMessage"> <assign to="HTTPClientAdapter">HttpClientAdapter_DynamicService</assign> <assign to="RemoteHost">10.11.23.31</assign> <assign to="RemotePort">30040</assign> <assign to="." from="*"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="HTTP Client POST Service"> <participant name="HTTPClientPost"/> <output message="HTTPClientPostServiceTypeInputMessage"> <assign to="RawRequest">true</assign> <assign to="RawResponse">true</assign> <assign to="URI">/soap-new?service=StockQuoteWebservice</assign> <assign to="." from="*"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="HTTP Client End Session Service"> <participant name="HTTPClientEndSession"/> <output message="HTTPClientEndSessionServiceTypeInputMessage"> <assign to="." from="*"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> <operation name="SOA Inbound Message Processing Service"> <participant name="SOAInboundMsgProcessingService_Instance"/> <output message="SOAInboundMsgProcessingServiceInputMessage"> <assign to="." from="*"></assign> </output> <input message="inmsg"> <assign to="." from="*"></assign> </input> </operation> </sequence> </process>
- Execute the business process. This will be the response in the primary document:
<soapenv:Envelope xmlns:soapenv="http://schemas.ditasoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Header> <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/ oasis-200401-wss-wssecurity-secext-1.0.xsd"/> </soapenv:Header> <soapenv:Body> <stockout:GetQuoteResponse xmlns:stockout= "http://www.webservice.stockquoteout"> <stockout:GetQuoteResult>120.35</stockout:GetQuoteResult> </stockout:GetQuoteResponse> </soapenv:Body> </soapenv:Envelope>