Automic Workload Automation

  • 1.  SOAP-Web-Interface: How to process a SOAP response having xml-tags with namespaces using XPath?

    Posted Feb 19, 2018 08:12 AM
    Hallo,

    I have the following problem. I want to extract fields out of a SOAP-response. My response looks like this:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">    <soapenv:Body>        <ns0:Change_Query_ServiceResponse xmlns:ns0="urn:CHG_ChangeInterface_WS">             <ns0:Approval_Phase_Name>NORMAL - 001 - Annahmeprüfung (RFA-&gt;RFC)</ns0:Approval_Phase_Name>             <ns0:Chg_Assignee_Support_Company>MA 14-ADV</ns0:Chg_Assignee_Support_Company>
     ... and so on...

    I want to export e.g. the value of <ns0:Approval_Phase_Name>. How do I define the wright XPATH mentioning the namespace of ns0?

    Your documentation contains only examples without a namespace. Can you give me the XPath for this tag as an example?

    Thank you!


  • 2.  SOAP-Web-Interface: How to process a SOAP response having xml-tags with namespaces using XPath?

    Posted Feb 19, 2018 08:38 AM
    I find using an xpath builder such as https://www.freeformatter.com/xpath-tester.html to be the best way to generate the correct formula to extract the fields you want.

    In your case, to get to
    <ns0:Approval_Phase_Name>
    simply use: //ns0:Approval_Phase_Name/text()
    That will return the value of Approval Phase Name, even with the namespace.
    From there you should be able to build the xpath strings for any other elements you require



  • 3.  SOAP-Web-Interface: How to process a SOAP response having xml-tags with namespaces using XPath?

    Posted Feb 19, 2018 09:46 AM
    Sorry, I think I have to define the namespace (where?) or I have to expand it at every tag:

    +++++++++++++++++++++++++++++++++++++ Start of Runtime Exception ++++++++++++++++++++++++++++++++++++ ch.ethz.mxquery.exceptions.StaticException: Namespace prefix ns0 not bound      at ch.ethz.mxquery.iterators.DescendantOrSelfIterator.init(DescendantOrSelfIterator.java:159)      at ch.ethz.mxquery.iterators.DescendantOrSelfIterator.next(DescendantOrSelfIterator.java:168)      at ch.ethz.mxquery.xdmio.XDMSerializer.eventsToXML(XDMSerializer.java:176)      at ch.ethz.mxquery.xdmio.XDMSerializer.eventsToXML(XDMSerializer.java:286)      at com.automic.ra.parsing.run.XPathXQueryExecutor.executeXQuery(XPathXQueryExecutor.java:503)      at com.automic.ra.parsing.run.XPathXQueryExecutor.executeXPath(XPathXQueryExecutor.java:342)      at com.automic.ra.parsing.run.XPathXQueryExecutor.processQuery(XPathXQueryExecutor.java:178)      at com.automic.ra.parsing.run.QueryExecutor.executeQuery(QueryExecutor.java:111)      at com.automic.ra.parsing.run.QueryExecutor.processQueries(QueryExecutor.java:85)      at com.automic.soap.job.SOAPJob.processParsing(SOAPJob.java:242)      at com.automic.soap.job.SOAPJob.run(SOAPJob.java:223)      at com.automic.soap.job.SOAPJob$run.call(Unknown Source)      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)      at SOAP.runJob(WebServiceSoap.groovy:704)      at com.uc4.extensibility.types.CITAgent.dispatchJob(CITAgent.java:258)      at com.uc4.ex.cit.CITJob.execute(CITJob.java:194)      at com.uc4.ex.Job.run(Job.java:469)      at com.uc4.ex.ThreadPool$RunnableDecorator.run(ThreadPool.java:53)      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)      at java.util.concurrent.FutureTask.run(FutureTask.java:266)      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)      at java.lang.Thread.run(Thread.java:745) ++++++++++++++++++++++++++++++++++++++ End of Runtime Exception ++++++++++++++++++++++++++++++++++++++