查找

記事
· 2021年3月18日 2m read

VSCode Tips & Tricks - SOAP Wizard

Another VSCode "Tips & Tricks" entry -

Do you want to see this option in VSCode?

This time we'll focus on how to get the SOAP Wizard as was available in Studio (to define a WSDL-based SOAP Web Service client (and Business Operation), or service).

If you work with Web Services you most probably used the SOAP Wizard in Studio. You would open it via Tools -> Add-Ins

And this opened a "Server Template" -

In VSCode you might be wondering how you can access this.

Well the basic fact you need to understand is that truly this Add-In or Wizard is simply a web page, displayed within Studio per above, and as such can also be accessed in a simple browser. VSCode facilitates the opening of such a browser with the desired content (ultimately constructing the correct URL with the right server name, port, web application, etc.).

The result would be the same as you see an option to open the Management Portal or the Class Reference (with relevant URLs) when you click on the Server Connection on the bottom Status Bar of VSCode, for example:

You will also see an entry for the SOAP Wizard.

You can achieve this by adding a 'links' entry in to your 'conn' object in your Settings JSON of your ObjectScript Extension, and specifying the desired URL (using the relevant variables).

This is mentioned in the VSCode ObjectScript's GitHub Issues discussion under a "SOAP Wizard" issue, with comments by @John Murray and @Ondřej Hoferek, and also referred to in this comment on a Community post by @Timothy Leavitt 
 

The JSON value would be:

"SOAP Wizard": "${serverUrl}/isc/studio/templates/%25ZEN.Template.AddInWizard.SOAPWizard.cls?Namespace=${namespace}${serverAuth}"

 

And this part would look like this:

Once you have this you will see an extra option when you click on the Connection -

And choosing that option will take you to the desired Wizard (opened in a Browser):

Here's a short GIF demonstrating this process (starting from the regular menu when clicking the Connection, and ending with the menu including the SOAP Wizard).

 

Note there are other Wizards (or Templates) you can add this way (like the XSD Wizard for example).

4 Comments
ディスカッション (4)3
続けるにはログインするか新規登録を行ってください
記事
· 2021年3月10日 3m read

RESTでセッション共有化する方法

これは InterSystems FAQ サイトの記事です。

REST アプリケーションはステートレスであることが想定されています。

しかし、複数の REST 呼び出し間でデータを保持したい場合などの理由で、Webセッションを使用したい場合は、UseSession パラメータを使用することができます。

以下のように、Web アプリケーションのディスパッチクラスとして定義された %CSP.REST のサブクラスでUseSession パラメータを指定することで、CSPと同じようにWebセッションを使用することが可能となります。

Class REST.MyServices Extends %CSP.REST
{
 Parameter UseSession As Integer = 1;


詳細は以下のドキュメントをご覧ください。

REST での Web セッションの使用


以下は、UseSession パラメータを使用した簡単なサンプルになります。最初に、2つのクラスを作成してください。


REST.SessionTest.cls

Class REST.SessionTest Extends %CSP.REST
{

Parameter UseSession As Integer = 1;

XData UrlMap
  {
    <Routes>
      <Route Url="/test/" Method="GET" Call="test"/>
    </Routes>
  }

ClassMethod test() As %Status
  {
    write "{""SessionId"":"""_%session.SessionId_"""}"
    quit $$$OK
  }
}


REST.test.cls

Class REST.test Extends %CSP.Page
{
ClassMethod OnPage() As %Status
  {
  &html<
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> 
<script type="text/javascript" src="http://code.jquery.com/jquery-2.2.4.js"></script>
<script type="text/javascript">
function go() {
   $.ajax({
     type:'GET',
     dataType:'json',
     url:'/csp/user/rest/test/',
     success:function(data) {
       ans = '';
       for(var i in data) {
           ans = ans + '\n' + JSON.stringify(data[i]);
       }
       alert(ans);
     }
   });
  return;
  }
  </script>

      </head>
      <body>
        <form name="xxx" method="post" action="">
          <input type="button" name="test" onclick="go();" value="push" /></p>
        </form>
        Session ID: #(%session.SessionId)#<br>
      </body>
    </html>


サンプルの使用方法は以下になります。

1. 上記2つのクラスをUSERネームスペースに作成し、コンパイルする

2. ウェブアプリケーション /csp/user/rest を作成、
     ディスパッチクラスに REST.SessionTest を設定、
     セッションCookieパスを /csp/user に変更して保存

 

3. ブラウザで /csp/user/REST.test.cls を開いて、push ボタンを押す

 

ディスカッション (0)0
続けるにはログインするか新規登録を行ってください
ディスカッション (3)1
続けるにはログインするか新規登録を行ってください
質問
· 2021年3月10日

How to give write permission by code without write permission ERROR:#5388

I want to operate on the class in enslib, but I don't have write permission. How can I modify the permission with code, or which table is given write permission

ERROR:#5388 - You do not have write permission on the database class ,so class lock cannot be obtained .

2 Comments
ディスカッション (2)1
続けるにはログインするか新規登録を行ってください
質問
· 2021年3月3日

How to update Ensemble - Business Hosts settings (default and custom settings) through code ?

Hi ,

I have a requirement to programmatically fetch and update a Business Process Setting . It's a custom property , added in extended class .

I am trying find a sample, but no luck. 

Could any one help me ? 

3 Comments
ディスカッション (3)0
続けるにはログインするか新規登録を行ってください