Lets take an example in which we want to call external webservice proxied by the OSB. In this example we are going to use following concept.
Service Consumer <—> OSB Proxy Service <—> OSB Business Service <–>Service Producer
Service consumer :- Client application that want to perform operation that is exposed by OSB
OSB Proxy Serbvice :- This are the proxy service or gate way through which Client application talk to OSB.
OSB Business Service:- This are the service layer not exposed to client side but deal with the Back end system to fetch or perform CRUD operation
Service Producer :- This are the system that provide the real implementation of requirement.
So in short client make a WSDL call to Proxy. Further proxy make a call to business service. And finally Business Service make call to Origianl Sergice producer to perform action.
There are two ways to implement this
1- using Jdeveloper
2- using Oracle OSB Console
Before taking above two example make sure to have your service producer ready. As i am not having any service producer i am using SoapUi to expose the WSDL file. For our example we had taken a WSDL file Temperature_WSDL.wsdl (available on https://www.w3schools.com/xml/tempconvert.asmx?WSDL)
Lets take first example
1- using Jdeveloper
Follow the below screen step to perform the same.
Lets first create a Business service as shown below
Drag and drop the HTTP from the pallete to External Service or you can also create business service by right click on the application and create new business service.
Now lets create Proxy service along with proxy pipeline as shown belwo
Now connect both Pipeline with Business service
Lets run the project by right click on the project and select run
now open the sbconsole
http://localhost:7101/sbconsole
and test the proxy server as shown below
Note: You can individual test services like proxy and business by right click on the icon in JDeveloper and selecting run. IT will open html viewer and you can place the soap request and get the response.
Now lets test our OSB flow using SOAPUI
i.e. calling Proxy service of osb that will direct the flow to Business service using pipeline and finally business service will call to our SOAPUI which act as an Service producer.
Please note we are again using the SOAPUI as external Service consumer to perform above flow.
The Link to test Proxy Service is Given below
http://[OSB SERVER]:[OSB PORT]/URI?wsdl
where
- OSB SERVER: IP Address or localhost
- OSB PORT: 7010.
If this does not work then try shutting down OSB server through command prompt.
In the log you see the listening port as 8011 which confirms OSB PORT as 8011. If it is something else then note down that and use the same
3.URI
Get this from OSB console
Go to http://localhost:7101/sbconsole
Click on Project Explorer
Click on Proxy Service
See the following
Endpoint URI /ConsumerOSBProducerProject/ConsumerOSBProducerPipelineProxyService
Use the above and append with ?wsdl
Hence the complete URL is
http://localhost:7101/ConsumerOSBProducerProject/ConsumerOSBProducerPipelineProxyService?wsdl
Create a new SOAP project in SOAPUI as shown below and run the request
Note: I observer that when i create the SOAPUI SOAP project using using
http://localhost:7101/ConsumerOSBProducerProject/ConsumerOSBProducerPipelineProxyService?wsdl
My request soap xml was this
?
when i hit the url in that case i got an error
soapenv:Server OSB-382000: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '/' (code 47) expected '=' at [row,col {unknown-source}]: [1,84] com.bea.wli.sb.service.handlerchain.HandlerException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '/' (code 47) expected '=' at [row,col {unknown-source}]: [1,84] at com.bea.wli.sb.service.handlerchain.handlers.ComputeOperation$1.getPayload(ComputeOperation.java:204) at com.bea.wli.sb.services.bindinglayer.BindingOperationMapper$QNameMapper.computeOperationName(BindingOperationMapper.java:564) at com.bea.wli.sb.service.handlerchain.handlers.ComputeOperation.dispatch(ComputeOperation.java:93) at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:129) at com.bea.wli.sb.service.handlerchain.handlers.InboundMessageContentHandler.dispatch(InboundMessageContentHandler.java:170) at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:129) at com.bea.wli.sb.service.handlerchain.handlers.CheckAccessControl.dispatch(CheckAccessControl.java:73) at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:129) at com.bea.wli.sb.service.handlerchain.handlers.UpdateInboundTransportStatistics.dispatch(UpdateInboundTransportStatistics.java:64) at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:129) at com.bea.wli.sb.service.handlerchain.handlers.AbstractHandler.dispatch(AbstractHandler.java:129) at com.bea.wli.sb.service.handlerchain.handlers.DefaultInboundErrorHandler.dispatch(DefaultInboundErrorHandler.java:44) at com.bea.wli.sb.service.handlerchain.DefaultInboundHandlerChain.dispatch(DefaultInboundHandlerChain.java:135) at com.bea.wli.sb.transports.TransportDispatcherClient.dispatch(TransportDispatcherClient.java:96) at com.bea.wli.sb.transports.TransportManagerImpl.receiveMessage(TransportManagerImpl.java:330) at com.bea.wli.sb.transports.http.generic.RequestHelperBase.invokePipeline(RequestHelperBase.java:253) at com.bea.wli.sb.transports.http.wls.HttpTransportServlet$RequestHelperWLS.invokePipeline(HttpTransportServlet.java:257) at com.bea.wli.sb.transports.http.generic.RequestHelperBase$1.run(RequestHelperBase.java:220) at com.bea.wli.sb.transports.http.generic.RequestHelperBase$1.run(RequestHelperBase.java:216) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:386) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:163) at com.bea.wli.sb.util.security.SecurityUtils.executeAs(SecurityUtils.java:102) at com.bea.wli.sb.transports.http.generic.RequestHelperBase.securedInvoke(RequestHelperBase.java:214) at com.bea.wli.sb.transports.http.generic.RequestHelperBase.service(RequestHelperBase.java:142) at com.bea.wli.sb.transports.http.wls.HttpTransportServlet.service(HttpTransportServlet.java:150) at weblogic.servlet.FutureResponseServlet.service(FutureResponseServlet.java:24) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:295) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:353) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:248) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3797) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3763) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344) at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2451) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2299) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2277) at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1720) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1680) at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:272) at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:352) at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:337) at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:57) at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:655) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:420) at weblogic.work.ExecuteThread.run(ExecuteThread.java:360) Caused by: java.io.IOException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '/' (code 47) expected '=' at [row,col {unknown-source}]: [1,84] at com.bea.wli.sb.sources.StreamingSoapEnvelopeSource.skipToBodyAndValidateWithStAX(StreamingSoapEnvelopeSource.java:275) at com.bea.wli.sb.sources.StreamingSoapEnvelopeSource.getReader(StreamingSoapEnvelopeSource.java:146) at com.bea.wli.sb.service.handlerchain.handlers.ComputeOperation$1.getPayload(ComputeOperation.java:175) … 53 more Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '/' (code 47) expected '=' at [row,col {unknown-source}]: [1,84] at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:666) at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:3102) at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:3033) at com.ctc.wstx.sr.BasicStreamReader.handleRootElem(BasicStreamReader.java:2177) at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2157) at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1180) at javax.xml.stream.util.StreamReaderDelegate.next(StreamReaderDelegate.java:88) at com.bea.wli.sb.sources.StreamingSoapEnvelopeSource$StAXHelper.toNextStartTag(StreamingSoapEnvelopeSource.java:392) at com.bea.wli.sb.sources.StreamingSoapEnvelopeSource.skipToBodyAndValidateWithStAX(StreamingSoapEnvelopeSource.java:234) … 55 more
To over come make sure your request should have ns and not x
ie.e.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.w3schools.com/xml/">
<soapenv:Header/>
<soapenv:Body>
<ns:FahrenheitToCelsius>
<!--Optional:-->
<ns:Fahrenheit>?</ns:Fahrenheit>
</ns:FahrenheitToCelsius>
</soapenv:Body>
</soapenv:Envelope>
No comments:
Post a Comment