I make and consume WS calls all day between 4D and SAP ECC/SAP CRM.  My
ABAP guy continually reminds me that SAP does not like complex data types;
although he claims Text arrays are acceptable.  I have not not been able to
get Text arrays to work.

On the send side, I send well formed XML with multiple headers and 100's of
records without issue.  It takes a little work and a good ABAP programmer
but it is rock solid once you get it going.

The XML Structure is a little funky when consuming from SAP; depending on
the data complexity.  I now convert everything from XML to JSON. Here is a
great Tech Note if you are interested:  https://kb.4d.com/assetid=77416

On Tue, Feb 18, 2020 at 5:00 PM Jason Hect via 4D_Tech <[email protected]>
wrote:

>
> Hi David,
>
> Thanks for the response.  Yeah, this is basically what I am proposing we
> do. I'll define a blob parameter (and now I see 4D can define XML or DOM
> SOAP parameters too!), which they pass everything too.  I take the contents
> of that single parameter and parse it out.
>
> What the SAP team is telling me is I should be able to define a "record"
> (for lack of better term), which might have numerous parameters.  These can
> be int/real/string/boolean/array/etc.  That would all be for a single
> record entry.  But if SAP has 10 "records" to send, they don't want to call
> the web service 10 times, but rather call the web service once, with all 10
> records in that single call.
>
> Normally 4D makes it so easy to create and consume web services, but this
> is beyond my knowledge of SOAP and Web Services.  I'm 99% sure 4D can't do
> this, but was hoping for a definitive answer so I can let the SAP team know
> and move onward with other solutions.
>
> Hope that makes sense and grateful for any other insight you might have.
>
> Thank You!
> Jason
>
> -----Original Message-----
> From: "David Ringsmuth" <[email protected]>
> Sent: Tuesday, February 18, 2020 10:38am
> To: "4D iNug Technical" <[email protected]>
> Cc: "JasonH" <[email protected]>
> Subject: RE: Web Services - Receiving Complex Type
>
>
>
>
> Jason,
>
> I use 4D’s SOAP Webservice to receive hierarchical packets of records
> defined in XML.
>
> I’m not clear on your question, so please forgive me if I fail to answer
> it:
>
> C_TEXT(tMonitorPswd;tMonitorEmail;tCurrentMachine;tCurrentMachineOwner)
> C_TEXT($tMonitorPswd;$tMonitorEmail;$tCurrentMachine;$tCurrentMachineOwner)
> C_LONGINT(ws_errorCode)
> C_TEXT(ws_errorText)
> C_LONGINT($ws_errorCode)
> C_TEXT($ws_errorText)
> ws_errorCode:=0  // 0=No Error
> ws_errorText:=""
>
> C_BLOB(xBlob;xResult;$xBlob;$xResult)
> ARRAY TEXT(atProviderIDs;0)
>
> SOAP_Err_Handle_Install (1)
> ws_Debug
>
>   //compiler_web
>
> SOAP DECLARATION(tMonitorEmail;Is text;SOAP input;"MonitorEmail")
> SOAP DECLARATION(tMonitorPswd;Is text;SOAP input;"MonitorPswd")
> SOAP DECLARATION(tCurrentMachine;Is text;SOAP input;"CurrentMachine")
> SOAP DECLARATION(tCurrentMachineOwner;Is text;SOAP
> input;"CurrentMachineOwner")
>
> SOAP DECLARATION(xBlob;Is BLOB;SOAP input;"xBlob")
>
> SOAP DECLARATION(fAuthentic;Is boolean;SOAP output;"Authentic")
> SOAP DECLARATION(ws_errorCode;Is longint;SOAP output;"ws_ErrorCode")
> SOAP DECLARATION(ws_errorText;Is text;SOAP output;"ws_ErrorText")
> SOAP DECLARATION(xResult;Is BLOB;SOAP output;"xResult")
> SOAP DECLARATION(nCnt;Is longint;SOAP output;"nCnt")
> fAuthentic:=Monitor_Authenticate_Local
> (tMonitorEmail;tMonitorPswd;tCurrentMachine;tCurrentMachineOwner;Current
> method name)
> $fAuthentic:=fAuthentic
>
>
> ws_Declare_Cnts ("Init")
> SOAP DECLARATION(nProviderCnt;Is longint;SOAP output;"nProviderCnt")
> SOAP DECLARATION(nLicenseCnt;Is longint;SOAP output;"nLicenseCnt")
> SOAP DECLARATION(nMenusCnt;Is longint;SOAP output;"nMenusCnt")
> SOAP DECLARATION(nHome_VisitCnt;Is longint;SOAP output;"nHome_VisitCnt")
> SOAP DECLARATION(nParentCnt;Is longint;SOAP output;"nParentCnt")
> SOAP DECLARATION(nChildCnt;Is longint;SOAP output;"nChildCnt")
> SOAP DECLARATION(nMeal_CountCnt;Is longint;SOAP output;"nMeal_CountCnt")
> SOAP DECLARATION(nTrainingCnt;Is longint;SOAP output;"nTrainingCnt")
> SOAP DECLARATION(nWorksheetCnt;Is longint;SOAP output;"nWorksheetCnt")
>
> If ($fAuthentic)
>                 READ ONLY(*)
>
>                 C_TEXT($xml;$xPath;$xml_root;$tRIS;$tTableNo)
>                 C_POINTER($pTable)
>
>                 $xPath:="/Providers"
>                 $xml_root:=xmlRec_NewRecord ("Providers")
>                 $pTable:=->[Provider]
>                 $tTableNo:=String(Table($pTable))
>
>
>                 ARRAY TEXT($atProviderIDs;0)
>                 BLOB TO VARIABLE(xBlob;$atProviderIDs)
>
>                 QUERY WITH ARRAY([Provider]ID;$atProviderIDs)
>
>                 $tRIS:=String(Records in selection([Provider]))
>                 DOM SET XML
> ATTRIBUTE($xml_root;"TableNo";$tTableNo;"Selection";$tRIS)
>
>                 C_LONGINT($i;$k;nCnt)
>                 nCnt:=0
>                 nProviderCnt:=Size of array($atProviderIDs)
>
>                 Web_Log_SOAP (Current method name;"Getting "+String(Size
> of array($atProviderIDs))+" Provider(s) and Related")
>
>                 For ($i;1;Size of array($atProviderIDs))
>
>
> QUERY([Provider];[Provider]ID=$atProviderIDs{$i})
>
>                                 Case of
>                                                 : (Records in
> selection([Provider])=0)
>
> ws_errorCode:=-1
>
> ws_errorText:="No Provider record found for ID "+$atProviderIDs{$i}
>                                                 : (Records in
> selection([Provider])>1)
>
> ws_errorCode:=-1
>
> ws_errorText:="Multiple Providers  found for ID "+$atProviderIDs{$i}
>                                                 Else
>
>
> C_DATE($d90DaysAgo)
>
> C_LONGINT($nProvider_TableNo)
>
> C_TEXT($Path_Record)
>
>
> $d90DaysAgo:=Add to date(Current date;0;0;-90)
>
> $nProvider_TableNo:=Table(->[Provider])
>
>
> $Path_Record:=$xPath+"/"+Table name(->[Provider])+"["+String($i)+"]"
>                                                                 $xml:=DOM
> Create XML element($xml_root;$Path_Record)
>                                                                 DOM SET
> XML ATTRIBUTE($xml;"TableNo";String(Table(->[Provider])))
>
>                                                                 For
> ($k;1;Get last field number(->[Provider]))
>
>       If (Is field number valid($nProvider_TableNo;$k))  // 02/01/17 DBR:
> sync dis-similar structures
>
>                       $tValue:=xmlRec_FieldValue
> (Field($nProvider_TableNo;$k))
>
>                       xmlRec_AddField ($xml;Field
> name($nProvider_TableNo;$k);$tValue)
>
>       End if
>                                                                 End for
>
>
> xmlSelection_Add
> (1;->[License]ID;->[Provider]License_ID;$xml_root;$Path_Record)
>
> xmlSelection_Add
> (1;->[Menus]Provider_ID;->[Provider]ID;$xml_root;$Path_Record;->[Menus]Menu_Date;$d90DaysAgo)
>
> xmlSelection_Add
> (1;->[Home_Visit]Provider_ID;->[Provider]ID;$xml_root;$Path_Record;->[Home_Visit]Visit_Date;Add
> to date(Current date;-3;0;0))
>
>
> QUERY([Child];[Child]Provider_ID=[Provider]ID)
>                                                                 If
> (Records in selection([Child])#0)
>
>       BB_RelateSelection (->[Parent]ID;->[Child]Parents_ID)
>
>       If (Records in selection([Parent])#0)
>
>                       xmlSelection_Add
> (0;->[Parent]ID;->[Child]Parents_ID;$xml_root;$Path_Record)
>
>                       xmlSelection_Add
> (1;->[Child]Provider_ID;->[Provider]ID;$xml_root;$Path_Record)
>
>       End if
>                                                                 End if
>
>
> xmlSelection_Add
> (1;->[Meal_Count]Provider_ID;->[Provider]ID;$xml_root;$Path_Record;->[Meal_Count]Month;$d90DaysAgo)
>
>
> BB_RelateSelection (->[Worksheet]Meal_Count_ID;->[Meal_Count]ID)
>
> xmlSelection_Add
> (0;->[Worksheet]Meal_Count_ID;->[Meal_Count]ID;$xml_root;$Path_Record)
>
>
> xmlSelection_Add
> (1;->[Training]Monitor_ID;->[Provider]Monitor_ID;$xml_root;$Path_Record)
>
>                                 End case
>
>                 End for
>
>                 nCnt:=nCnt+Size of array($atProviderIDs)
>                 $nCnt:=nCnt
>
>                 If (Bool(Storage.debug.On))
>                                 ws_ExportToFile ($xml_root;"Providers")
>                 End if
>
>                 DOM EXPORT TO VAR($xml_root;xResult)
>                 DOM CLOSE XML($xml_root)
>
> End if
> SOAP_Err_Handle_Install (0+2)
>
> David Ringsmuth
>
>
> From: [ JasonH via 4D_Tech ]( mailto:[email protected] )
> Sent: Tuesday, February 18, 2020 11:19 AM
> To: [ [email protected] ]( mailto:[email protected] )
> Cc: [ JasonH ]( mailto:[email protected] )
> Subject: Web Services - Receiving Complex Type
>
> Forgive the double post, but my first was in the general "4D" forum and 4D
> tech support suggested posting in the "4D Tech" forum.  I'm not sure if
> people look at both forums, hence the double post.
>
>
> -------------------------------------------------------------------------------------------
>
> I need to define a 4D web service called by SAP sending multiple records in
> a single request.  In a nutshell 4D will be uploading a bunch of sales
> orders to SAP, and SAP will invoice and return all the invoice numbers in
> one request.  Something like:
>
> <element name="SAP_Invoice">
>      <complexType>
>           <sequence>
>                <element minOccurs="1" maxOccurs="1" name="Sales_Order_No"
> type="xsd:string"/>
>                <element minOccurs="1" maxOccurs="1" name="Invoice_No"
> type="xsd:string"/>
>           </sequence>
>      </complexType>
> </element>
>
> I don't see any way to do this when defining the web service in 4D with
> SOAP
> DECLARATION?  Anything I do is defined as a single occurrence only.  I
> suggested having SAP send 2 matched arrays, which I can do by declaring the
> input as type array, but they don't want to do that.
>
>
>
> --
> Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
>
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:[email protected]
> **********************************************************************
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to