Excellent, thank you- This should work.
- Log in to post comments
Excellent, thank you- This should work.
Would it be possible to implement a POST instead and pass the information containing the / characters as part of the body rather than the URL?
Assuming this is on 2016.2 you could override the %ToJSONValue method which is used to generate the JSON.
Here's my code, of course I could shrink this down a lot, but figured people might want to read it.
Personally, I think looking at different ways of doing the same thing are a great learning lesson. Judging based on the length of the code, simply encourages bad programming.
ClassMethod toPhone(i As %String)
{
set k="----abc-def-ghi-jkl-mno-pqrstuv-wxyz ---"
set i=$zconvert(i,"L"),o=""
f p=1:1:$l(i) s c=$e(i,p),d=$f(k,c)\4+1,r=3-(d*4-($f(k,c))) s:r<1 r=4+r,d=d-1 s:d>9 d=0 s z="",$p(z,d,r+1)="",o=o_$s($e(o,$l(o))=d:" ",1:"")_z
q o
}That must have been where I missed it. I think I was looking at docs for 2016.1 and didn't see it there
Definately . $toJSON is the easiest method to get a persistent object to JSON, also more efficient
SQL method works great too if you don't necessarily want the whole object.
Reading the documentation it seems to be saying that you should exclude directories containing files that are actively used by Cache such as those containing databases, WIJ and journal files, etc.
It is not recommending that you disable virus scanning on all directories associated with Cache
Wow! Not sure how I missed that when I went through the docs looking for it.
Indeed exactly what I was lookimg for.
Things to consider
Does the SMTP server require SSL/TLS?
Are there any restrictions as to who can connect to the server. Eg, white listed IP addresses?
Some clients may simply not want to expose the /csp... to mask thay this is based on ISC technology.
Some customers may have existing Web apps they are migrating to ISC technology and they may want to mimic their existing URL naming conventions.
Hi Kamal
Have your checked then VistA Document Library which contains a wealth of information everything VistA.
There is also the VistA community on HardHats at http://www.hardhats.org
Your $zv looks very suspect Paul. On one hand you have a 2016.2 beta of Ensemble, but you have HealthShare libraries also which aren't distributed with Ensemble.
Was this a HealthShare instance of 2016.1 that you overlayed with a 2016.2 install of Ensemble?
I'm not sure that can ever be expected to work right.
Maybe try your service on a fresh install of 2016.2 beta and see if it works then, although you won't have access to the HS libraries
Can you provide the full version, including build # of your HealthShare instance? I'll try your service on the same identical version to see if I can duplicate it here.
The only strangeness I see here is that in your code you set pOutput to the result of HS.Test.Service.SendSync which returns a %Status.
In your method, the pOutput variable is used in the method declaration and is supposed to be a stream object because that is how the adapter responds back as the response to the http request.
I wonder if this could possibly be the problem. I have to admit that the behavior is very strange, if indeed that is the problem.
Also-
Can you provide a copy of the code that should go where your example shows.
// Nothing in here gets touched, thus my problem
Interesting, I took your code and just added some code to the OnProcessInput method so that it would just take a string int he body of the http request and then echo that string back as the response. here is the code, which when tested with my http test tool seems to work fine which would indicate that there might be a problem elsewhere.
What settings are you using when adding your service to the production, and what version of Ensemble are you using?
Here's a copy of the working code I tested in 2016.1
Class Community.Services.MyService Extends Ens.BusinessService
{
/// Set Adapter
Parameter ADAPTER = "EnsLib.HTTP.InboundAdapter";
/// Set this to 0 to prevent normalizing of HTTP header variable names to lowercase
Parameter TOLOWERHEADERVARS = 1;
/// Set this to make page parse form variables from the form body in case of a form POST
Parameter PARSEBODYFORMVARS = 0;
/// Copied from EnsLib.HTTP.Service
Method OnInit() As %Status
{
If $IsObject(..Adapter) {
Set ..Adapter.%ToLowerHeaderVars=..#TOLOWERHEADERVARS
Set ..Adapter.ParseBodyFormVars=..#PARSEBODYFORMVARS
}
Quit ##super()
}
/// Same method signature as EnsLib.REST.Service
Method OnProcessInput(pInput As %Library.AbstractStream, Output pOutput As %Stream.Object = {$$$NULLOREF}) As %Status
{
set pOutput=##class(%GlobalCharacterStream).%New()
set string=pInput.Read()
do pOutput.Write(string)
quit $$$OK
}
}
Here's an example of a business service that receives input in the form of a delimited string, passes the input off to a business process (in your case it would be a business operation), gets the response and returns the response as the return document.
Class AC.Services.HTTPService Extends Ens.BusinessService
{
Parameter ADAPTER = "EnsLib.HTTP.InboundAdapter";
Method OnProcessInput(pInput As %GlobalCharacterStream, Output pOutput As %Stream.Object) As %Status
{
// Instanciate the output stream
set pOutput=##class(%GlobalCharacterStream).%New()
// Read the delimited string passed in the content stream
set iStr=pInput.Read(,.tSC)
// Build the request message
set request=##class(AC.Messages.RouteMessagePreProcessRequest).%New()
set request.DOB=$p(iStr,"^",1)
set request.Facility=$p(iStr,"^",2)
set request.RXNumber=$p(iStr,"^",3)
set request.SSN4=$p(iStr,"^",4)
set request.CMOPFlag=$p(iStr,"^",5)
// Send request message to RouterPrePRocess
do ..SendRequestSync("RouteMessagePreProcess",.request,.response)
// Return response to caller
do pOutput.Write(response.RESP)
Quit $$$OK
}
}
Can you post a copy of your service?
You should use an Ensemble REST web service which is a sub-class of EnsLib.REST.Service
I would recommend starting with reviewing the documentation on CSP REST services which can be found at the link below. This will give you a basic understanding of how Ensemble implements RESTful web services.
http://docs.intersystems.com/ens201513/csp/docbook/DocBook.UI.Page.cls?…
There is also an extension of the HTTP adapter that provides an interface for providing RESTful web services as part of your production. The documentation on how to implement this can be found here:
https://community.intersystems.com/product-documentation/creating-rest-…
Pretty sure Pretty sure Atelier is not compatible with versions prior to 2016.2
The services it uses aren't part of earlier versions
Jeff- Thanks
What I am really looking for here is a generic way to represent any global structure as JSON.
In my example, the top node contains both data as well as sub-nodes.
I'm not really looking for a way to represent a person in JSON, just a way to represent generic global structures taking into account the fact that a global node can have both data stored at that particular level as well as sub-nodes below it.
Hi Laura
Do you have a production already created that you are now trying to document? Or is this a case where your are getting ready to develop your first production in Ensemble?
Weblink is downloadable from our Worldwide Response Center portal at http://wrc.intersystems.com
It does appear that the public download page is no longer available.
Ken
I have to say that I never thought of using Google to search our documentation until a colleague pointed it out to me a while back.
Need the function to determine your process id.
Open Google, enter "intersystems determine process id"
First returned document is the documentation for the $JOB symbol variable which contains your process id.
I have to say that as an Intersystems employee I was disappointed when I heard that the feature maps were going away. I cant say how many times I used to use those maps for jumping to a key feature that I wanted to know about.
However, since I started using Google to search the docs the docs have become much more friendly and easy to locate what I'm looking for.
Change is hard....
It should work going from Windows to RHEL without conversion.
Going from the same version of Cache to the same version, e.g. 2015.1 to 2015.1 should work without any changes. Going to a newer version, one should follow the appropriate upgrade procedures in the documentation for the particular version.
Going back versions can present multiple problems and is not recommended. If you were to want to go from say 2015.1 to 2014.1, you would most likely want to export and import data, classes and routines. From one version to another, new keywords and classes, etc may have been added that are not compatible with older versions.
Some platforms do have different endian versions, for example, going from Windows to AIX on PowerPC requires the cvendian tool to be run to convert the the endian versions.
Hi Francis
One place to start might be the introduction to Cache ObjectScript and introduction to Cache Objects online courses. Both take about 45min to an hour to complete.
You can access these with registration here: http://learning.intersystems.com
ken
In Cache, due to the way we store data on disk, partitioning the data may not give you a significant benefit in access time. Data is stored in a highly optimized fashion and the effort to retrieve a record stored at the "top" of a table takes no more effort to retrieve than a record stored at the "bottom" of a table.
If you have records within a table that need to be located quicker (different than being retrieved from disk) you may want to consider setting up some useful indexes that you can use to locate specific records within the table.
Do you have an example of your table structure and could you explain what you mean by more frequently accessed data?
You could use %GOF for export and %GIF for import from Terminal. These tools export block level data. The ultimate size of the export will be much less than other tools
Is this a one-time migration of data from instance A to instance B?
If so, create a new database on instance A and then use GBLOCKCOPY to copy from the existing database to the new one. Then just move the new database to instance B
Data type validation occurs when you run the % Save () method to persist the object in the database
Perhaps you could run %Save() and only run the XXL Export if the %Save was successful
There are lots of terms here that although may be related really pertain to different things.
This post mentions client/server and services and applications. Both services and applications can be implemented in a client/server architecture.
A service is an application that typically has a client and a server side component. Common types of web services are SOAP web services and RESTful web services. They usually provide some very specific function. For example; a USPS address verification service does nothing but receive a message containing an address that needs to be verified, verifies it, and then sends a response message back to the client with the results of that verification.
An application can also be developed using a client/server architecture where there is a software component that runs on the client and a separate software component that runs on the server. Unlike a service, in a client/server application business logic may be handled at either the client or the server, or both, allowing for distribution of resources. The client and server parts of an application typically communicate with each other using services.
CSP and Zen, as well as other technologies like PHP, Java Server Pages, ASP.Net are all server-side scripting languages. The purpose of each is to generate some dynamic document that is then sent to a web-browser by a web server and then rendered (or presented) to the user by a web browser running on the user's computer. Both Zen and CSP allow you to embed Javascript within the document in various ways. Javascript is executable code that is run within the web browser. Typically Javascript is used for form validation and different interactions between the various parts of a web-page. It prevents the need to have to call the server every time that you want to update a web page.
Thanks Ben- This does help. What I was missing was....
1. On the <form> element you need the multi-part encoding specified,
and then when you process the form on the server you need to look into the %request.MimeData to actually find the file stream.
Thanks