cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1719
Views
0
Helpful
1
Replies

Issue in parsing the response of a WebService in Service Link

I am getting issues in connecting an external (non cisco) application via WebService. Appreciate if anyone can help in fixing the issue. I am using 9.3.2 Patch 6.

  • Connectivity to an external system (a 3rd party application in my firm) was achieved via WebService using the ServiceLink module.
  • Used the Outbound HTTP/WS Adapter where I am sending request and receiving response (bi-direction).
  • Successfully constructed and passed the XML request to the WebService.
  • Received response from the WebService as an XML / Soap Message which is then wrapped with the <Message> tag with the channel-id attribute successfully.
  • Designed a XSL Transformation (For this WebService, the XSLT did not generated automatically) which, I hope is not being applied properly in CPSC; but working fine outside of CPSC when I have checked the response XML with the XSLT in an online editor (http://www.freeformatter.com/xsl-transformer.html). Everything looks perfect in this editor where I have issues in CPSC.
  • I am getting a Transformation exception in CPSC and the response message was unable to convert into the nsXML. The exception I am receiving is below. Not sure whether it is due to the namespace or something else..

Note: I am having this issue in this Agent/WebService alone. I have tested with couple other WebServices where I didn't have any issues in getting the response and update the field in CPSC form successfully. So, I believe that there are no issues in the parser in our server.

Exception Received:

org.xml.sax.SAXParseException: Premature end of file. at org.apache.xerces.parsers.DOMParser.parse(Unknown Source) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124) at com.newscale.bfw.util.XMLValidator.validate(XMLValidator.java:147) at com.newscale.is.core.MessageExecutor.processNSTaskTransportMessage(MessageExecutor.java:135) at com.newscale.is.core.MessageExecutor.processTransportMessage(MessageExecutor.java:431) at com.newscale.is.core.MessageExecutor.processSynchronousOutboundMessage(MessageExecutor.java:526) at com.newscale.is.adk.OutboundAdapterUtil.processSynchronousResponse(OutboundAdapterUtil.java:44) at com.newscale.is.adapter.http.HTTPOutboundAdapter.call(HTTPOutboundAdapter.java:190) at com.newscale.is.adapter.http.HTTPOutboundAdapter.processMessage(HTTPOutboundAdapter.java:147) at com.newscale.is.core.MessageRouter.routeMessage(MessageRouter.java:115) at com.newscale.is.core.MessageExecutor.processOutboundMessage(MessageExecutor.java:604) at com.newscale.is.core.MessageExecutor.processMessage(MessageExecutor.java:125) at com.newscale.is.core.QueueListener.handleTextMessage(QueueListener.java:91) at sun.reflect.GeneratedMethodAccessor110.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:340) at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:237) at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:168) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:73) at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101) at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:115) at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:285) at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:110) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:91) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:322) at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:213) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.interceptor.DefaultChannel.process(DefaultChannel.java:303) at org.apache.camel.processor.RouteContextProcessor.processNext(RouteContextProcessor.java:45) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73) at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90) at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:71) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:105) at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:561) at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:499) at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:467) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:325) at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:263) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1059) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1051) at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:948) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

Sample XML File received as response from the WebService – which then wrapped with the <message> tag along with appropriate channel-id.

<message channel-id="10a60e45-65d4-40c0-826f-1a91d2135da0">

<?xml version="1.0"?>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="

http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Body>

<ns:ITSPResponse xmlns:ns="urn:PegaRULES:SOAP:BNYMDataITSPTest:Services">

<Output>Test IT Service Portal - 1</Output>

</ns:ITSPResponse>

</soap:Body>

</soap:Envelope>

</message>

XSL Transformation

<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="

http://www.w3.org/1999/XSL/Transform" xmlns:ns="urn:PegaRULES:SOAP:BNYMDataITSPTest:Services">

<xsl:template match="/">

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="urn:PegaRULES:SOAP:BNYMDataITSPTest:Services">

<message>

<xsl:attribute name="channel-id">

<xsl:value-of select="//@*[local-name()='channel-id']" />

</xsl:attribute>

<send-parameters>

<agent-parameter>

<name>Output</name>

<value> <xsl:value-of select="//*[local-name()='Output']" /> </value>

</agent-parameter>

</send-parameters>

</message>

</xsl:template>

</xsl:stylesheet>

1 Reply 1

The reply I got from Cisco Engineering team for this is to get the response as a soap message than XML data.

The tag should not be available in the response received. If we don't have this, the response will still consider as a valid XML / Soap message after wrapped by the tag.

If we have the tag in the response, after wrapping the tag, the format of the response will not be in good format.

Also, Cisco Engineering team has confirmed that it is not possible to remove the tag from CPSC. It should be removed by the WebService providers while sending the response.

For my case, I am consuming the WebService from a tool similar to CPSC where the entire settings has to be changed to send the response format as soap message than XML. So, we need to have another WebService as a middleware! Bad day!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: