0

When i am trying to connect Mule Studio with SAP. i am getting error.

org.mule.api.transport.DispatchException: Message is not a SAP object, it is of type "String". Check the transformer for this Connector "connector.sap.mule.default". Failed to route event via endpoint: DefaultOutboundEndpoint{endpointUri=sap://function,

Please help me with this.

enter image description here

my xml file.....

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:sap="http://www.mulesoft.org/schema/mule/sap" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
http://www.mulesoft.org/schema/mule/sap http://www.mulesoft.org/schema/mule/sap/current/mule-sap.xsd">
    <flow name="SapFlow1" doc:name="SapFlow1">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="getSapDetails" doc:name="HTTP"/>
        <sap:outbound-endpoint type="function" rfcType="srfc" responseTimeout="10000" jcoAsHost="hostname" jcoUser="username" jcoPasswd="password" jcoSysnr="00" jcoClient="100" jcoLang="EN" doc:name="SAP"/>
    </flow>
</mule>
Anand Gajjar
  • 81
  • 2
  • 9

1 Answers1

0

You're missing bits of configuration. From the documentation:

Input Mule Messages

The outbound-endpoint expects a Mule Message carrying any of the following payloads:

  • org.mule.transport.sap.SapObjectinstance. This is a Java POJO, whose two main properties are:
    • type: SapType.FUNCTION (for a BAPI call) or SapType.IDOC (for an IDoc).
    • value: The specific JCo Object depends on the payload type: com.sap.conn.idoc.IDocDocument or com.sap.conn.idoc.IDocDocumentList for IDocs and com.sap.conn.jco.JCoFunction for BAPI calls.
  • Any other Object. You need to provide the XML definition with the attribute definitionFile or embedding it in the XML.

The payload can be transformed from a XML string or stream into a SapObject with the following transformers:

<!-- IDocs -->
<sap:xml-to-idoc/>

<!-- BAPI calls -->
<sap:xml-to-function/>
David Dossot
  • 33,350
  • 4
  • 35
  • 71
  • Soory for late reply....first of all is it possible to call sap function with HTTP request. the way i am calling function is right or wrong ??? – Anand Gajjar Dec 05 '13 at 05:40
  • In doesn't matter what transport you use to start the even in your flow: what matters is if you correctly pass the right parameters to the message processors you use in your flow after the inbound endpoint. – David Dossot Dec 05 '13 at 05:56
  • David, i have added above code in my XML file. still m getting the same error. please help me with this. – Anand Gajjar Dec 05 '13 at 08:55
  • What code? There are several possibilities based on your use case. Update your question then. – David Dossot Dec 05 '13 at 15:27
  • Well my scenario is i want to synchronize all the data from SAP through RFC and i want to save data locally in MYSQL db. is it possible via mulesoft tool ??? – Anand Gajjar Dec 10 '13 at 05:54
  • Yes, it sounds totally like the kind of things Mule will happily do for you. – David Dossot Dec 10 '13 at 20:10
  • David. actually i am new developer. can you guide me what i need to do to transfer data and how can i map SAP data with MySQL db. ??? and is there any possibility to get data in the form of JSON via HTTP request (For SAP connection) ??? – Anand Gajjar Dec 11 '13 at 12:28
  • Got it, but this is really a wide question because you're asking about some fundamental Mule knowledge here. Did you go through basic Mule training? Did you read Mule in Action, second edition? – David Dossot Dec 11 '13 at 21:30
  • Hello David. my problem is resolved. now i am able to get data from the sap. Thanks for your help. can you tell me how can i map username and password via http post request with SAP connection properties ??? i want to pass username and password dynamically.. – Anand Gajjar Dec 12 '13 at 11:54
  • Please accept my answer. If you receive these username+password as query parameters, you can get them from an inbound message property named `http.query.params`. See http://www.mulesoft.org/documentation/display/current/HTTP+Transport+Reference#HTTPTransportReference-HTTPProperties for more info. – David Dossot Dec 12 '13 at 16:07
  • if i do this. i will get the following error... message: Connect to SAP gateway failed Connection parameters: TYPE=A DEST=user@#[message.inboundProperties['hostname']]:00:100?zG6t72JtDg0A5/MyXeAo2w== ASHOST=#[message.inboundProperties['hostname']] SYSNR=00 PCS=1 LOCATION CPIC (TCP/IP) on local host with Unicode ERROR hostname '#[message.inboundProperties['hostname']]' unknown – Anand Gajjar Dec 13 '13 at 05:47