485
edits
m (add syntax highlighting) |
m (add syntax highlighting) |
||
Line 70: | Line 70: | ||
Finally you need to create a procedure that will utilise that client to ''reconstitute'' the XML from the data that your published method receives and call that procedure as the first thing each of your published methods do: | Finally you need to create a procedure that will utilise that client to ''reconstitute'' the XML from the data that your published method receives and call that procedure as the first thing each of your published methods do: | ||
Object oLogSample is a cWebService | <source lang="dataflex"> | ||
Object oLogSample is a cWebService | |||
Use cWSLogSample.pkg | Use cWSLogSample.pkg | ||
Object oOwnService is a cWSLogSample | Object oOwnService is a cWSLogSample | ||
End_Object | End_Object // oOwnService | ||
// LogMsg: The arguments are - 1 Data passed to the method | |||
// 2 Name of the method (literal) | // 2 Name of the method (literal) | ||
// 3 Name of the variable (literal) | // 3 Name of the variable (literal) | ||
// 4 Object handle for type - which will be named "oWS{typeName}" | // 4 Object handle for type - which will be named "oWS{typeName}" | ||
Procedure LogMsg Variant Data String sOp String sName Handle hoObj | |||
tSoapParameter Param | tSoapParameter Param | ||
Handle hoXML hoDoc | Handle hoXML hoDoc | ||
String sXML | String sXML | ||
Boolean bOK | Boolean bOK | ||
Get Create of Desktop U_cXmlDomDocument to hoXML | Get Create of Desktop U_cXmlDomDocument to hoXML | ||
Get CreateDocumentElementNS of hoXML (psServiceURI(Self)) sOp to hoDoc | Get CreateDocumentElementNS of hoXML (psServiceURI(Self)) sOp to hoDoc | ||
Get DefineStructParameter of oOwnService hoObj 1 1 sName (psServiceURI(Self)) to Param.SoapParamDef | Get DefineStructParameter of oOwnService hoObj 1 1 sName (psServiceURI(Self)) to Param.SoapParamDef | ||
ValueTreeSerializeParameter Data to Param.ValueTree | ValueTreeSerializeParameter Data to Param.ValueTree | ||
Get ValueTreeToXml of oOwnService Param.SoapParamDef Param.ValueTree hoDoc to bOK | Get ValueTreeToXml of oOwnService Param.SoapParamDef Param.ValueTree hoDoc to bOK | ||
Get psXML of hoXml to sXML | Get psXML of hoXml to sXML | ||
Send Destroy of hoDoc | Send Destroy of hoDoc | ||
Send Destroy of hoXML | Send Destroy of hoXML | ||
// Now you can log sXML in some way... | |||
End_Procedureb // LogMsg | |||
{ Published = True } | { Published = True } | ||
{ Description = "Interface for sending something to the system" } | { Description = "Interface for sending something to the system" } | ||
Procedure SendSomething tSomeDocumentType Doc | Procedure SendSomething tSomeDocumentType Doc | ||
Send LogMsg Doc "SendSomething" "Doc" (oWStSomeDocumentType(oOwnService(Self))) | |||
// Code that actually does stuff... | |||
End_Procedure | End_Procedure // SendSomething | ||
End_Object | End_Object // oLogSample | ||
</source> | |||
'''Warning:''' Note that each time you change your service, you should regenerate the web service client (as in [[#Step_2:_Create_a_Client | Step 2]]) immediately afterwards and then recompile your WebApp... <u>again</u>! | '''Warning:''' Note that each time you change your service, you should regenerate the web service client (as in [[#Step_2:_Create_a_Client | Step 2]]) immediately afterwards and then recompile your WebApp... <u>again</u>! |