2
votes

I think i'm getting close with this. I'm trying to invoke an insert call on a DSS service from and ESB in WSO2.

I have the DSS service setup and I am able to insert data into the table from the 'try it' link. I copied the WSDL to the ESB and referenced the endpoint. I can see the insert operation from the ESB try it service. I put in my data and click send. I see a 'success' response come back but nothing is being added to the table.

Is anyone willing to nudge me in the right direction with this?

Thank you!

Response from try it service

<success details="in-only operation"/>

proxy

   <?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
   name="MyProxy"
   transports="https,http,local,vfs"
   statistics="disable"
   trace="disable"
   startOnLoad="true">
<target>
   <inSequence>
      <property name="targetfilename" value="TITLES"/>
      <log level="full"/>
      <clone/>
   </inSequence>
</target>
<publishWSDL key="InsertServiceWSDL"/>
<parameter name="transport.PollInterval">15</parameter>
<parameter name="transport.vfs.ActionAfterProcess">MOVE</parameter>
<parameter name="transport.vfs.FileURI">file:///var/process
/rrin</parameter>

<parameter name="transport.vfs.MoveAfterProcess">file:///var/process
/rroriginal</parameter>

<parameter name="transport.vfs.MoveAfterFailure">file:///var/process
/rrfault</parameter>

<parameter name="transport.vfs.FileNamePattern">TITLES.xml</parameter>
<parameter name="transport.vfs.ContentType">application/xml</parameter>
<parameter name="transport.vfs.ActionAfterFailure">MOVE</parameter>
<description/>
</proxy>
2

2 Answers

2
votes

You'll need to add an address endpoint pointing to the DSS service. Refer to this sample which is on how to define a proxy service for an axis2 web service. Your scenario is very similar to this.

0
votes

Here is how I did it. The call will now hit the DSS and insert the data into the table. I am seeing some errors in the log for each XML row it processes and send to the DSS. I'm not sure why yet. I'm still researching that.

Edit: I changed the call mediator to a send mediator and that fixed this issue. I am no longer getting this error message.

Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1]
Message: Premature end of file.

Here is my sequence.

    <sequence xmlns="http://ws.apache.org/ns/synapse" name="MySequence">
   <log level="custom">
      <property name="sequence" value="MySequence"></property>
   </log>
   <property xmlns:ns="http://org.apache.synapse/xsd" name="filename" expression="get-property('transport', 'FILE_NAME')"></property>
   <log level="custom">
      <property xmlns:ns="http://org.apache.synapse/xsd" name="show-name" expression="get-property('filename')"></property>
      <property xmlns:ns="http://org.apache.synapse/xsd" name="file-name" expression="get-property('targetfilename')"></property>
   </log>
   <iterate xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" xmlns:z="RowsetSchema" expression="//z:row" id="It1">
      <target>
         <sequence>
            <property name="Id" expression="//z:row/@ID"></property>
            <property name="vch" expression="//z:row/@vch"></property>
            <log level="custom">
               <property name="showids" expression="get-property('Id')"></property>
               <property name="showvch" expression="get-property('vch')"></property>
            </log>
            <filter xpath="//z:row[starts-with(@vch, '978')]">
               <then>
                  <payloadFactory media-type="xml">
                     <format>
                        <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:p="http://ws.wso2.org/dataservice">
                           <soapenv:Body>
                              <p:insert_AR_operation>
                                 <p:ID xmlns:xs="http://ws.wso2.org/dataservice">$1</p:ID>
                                 <p:vch xmlns:xs="http://ws.wso2.org/dataservice">$2</p:vch>
                              </p:insert_AR_operation>
                           </soapenv:Body>
                        </soapenv:Envelope>
                     </format>
                     <args>
                        <arg expression="get-property('Id')" evaluator="xml"></arg>
                        <arg expression="get-property('vch')" evaluator="xml"></arg>
                     </args>
                  </payloadFactory>
                  <log level="custom">
                     <property name="sequence" value="Calling LevelsAR_ISBNService"></property>
                  </log>
                  <property name="HTTP_METHOD" value="POST" scope="axis2"></property>
                  <property name="SOAPAction" value="insert_AR_operation" scope="transport"></property>
                  <send>
                     <endpoint>
                        <address uri="http://*.*.*.*:****/services/AR_Service.HTTPEndpoint/"></address>
                     </endpoint>
                  </send>
               </then>
               <else>
                  <log level="custom">
                     <property name="sequence" value="Condition Drop"></property>
                  </log>
                  <drop></drop>
               </else>
            </filter>
         </sequence>
      </target>
   </iterate>
   <property xmlns:ns2="http://org.apache.synapse/xsd" xmlns:ns="http://org.apache.synapse/xsd" name="transport.vfs.ReplyFileName" expression="fn:concat(get-property('SYSTEM_DATE', 'yyMMddHHmmss'), '-', get-property('filename'))" scope="transport"></property>
   <property name="OUT_ONLY" value="true"></property>
</sequence>