API

In this forum you can ask for help, report errors, or share your experience with http://www.cadec-online.com

API

Postby Fer » Tue Jul 30, 2013 7:20 pm

Try the new CADEC Web Service!

This feature allows you to use your CADEC objects in other platforms such as

This interface is experimental, so any feedback is appreciated.
Fer
Site Admin
 
Posts: 76
Joined: Mon Apr 30, 2012 1:58 pm

Connect using Abaqus

Postby ebarbero » Sat Aug 03, 2013 4:23 pm

  1. Download PySimpleSOAP
  2. Open client.py, change line 103, from this:
    Code: Select all
    self.http = http(timeout=TIMEOUT, cacert=cacert, proxy=proxy, sessions=sessions)

    to this:
    Code: Select all
    self.http = Http(cacert=cacert, proxy=proxy, sessions=sessions)
  3. Save client.py
  4. Copy pysimplesoap folder to C:\SIMULIA\Abaqus\[Abaqus Version]\Python\Lib\
  5. Start Abaqus CAE
  6. Run this code in the prompt
    Code: Select all
    from pysimplesoap.client import SoapClient
    client = SoapClient(wsdl="http://www.cadec-online.com/API.asmx?WSDL",trace=False, sessions=True)
    client.Login("UserName", "Password")
    client.Laminates()
User avatar
ebarbero
 
Posts: 76
Joined: Mon May 21, 2012 11:24 am

Connect using C#

Postby ebarbero » Sat Aug 03, 2013 4:44 pm

  1. Create a Console application
  2. In Solution Explorer, References, Add Service Reference
  3. Click in Advanced...
  4. Click in Add Web Reference...
  5. in URL type http://www.cadec-online.com/API.asmx
  6. in Web Reference Name type CADEC
  7. Type this code
Code: Select all
CADEC.API MyCadec = new CADEC.API();
MyCadec.CookieContainer = new System.Net.CookieContainer();
if (MyCadec.Login("username", "password"))
{

    Console.WriteLine("LaminaId Lamina Name");
    foreach (String[] Lamina in MyCadec.Laminae())
    {
        Console.WriteLine(Lamina[0] + " " + Lamina[1]);
    }
}
else
{
    Console.WriteLine("Unable to login");
}

Console.ReadLine();
User avatar
ebarbero
 
Posts: 76
Joined: Mon May 21, 2012 11:24 am

Connect Using Matlab

Postby ebarbero » Sat Aug 03, 2013 4:48 pm

  1. Write callSoapService, select the word, right click, Open
  2. Write global cookie; just bellow the documentation
  3. Write this below %Set the appropriate HTTP parameters.
    Code: Select all
    if (~isempty(cookie))
        httpConn.setRequestProperty('Cookie', concat(concat(cookie.Name,'='),cookie.Value))
    end
  4. Write this bellow byteArrayOutputStream.close;
    Code: Select all
    i=0;
    while true
       headerField = httpConn.getHeaderField(i);
       if (headerField ~= '')
          if (strcmp(httpConn.getHeaderFieldKey(i), 'Set-Cookie'))
             headerField = headerField.substring(0,headerField.indexOf(';'));
             cookie.Name = headerField.substring(0, headerField.indexOf('='));
             cookie.Value = headerField.substring(headerField.indexOf('=') + 1, headerField.length());
          end
       else
          break
       end
       i = i+1;
    end
  5. Save callSoapService
  6. Write this in the prompt
    Code: Select all
    createClassFromWsdl('http://www.cadec-online.com/API.asmx?WSDL')
    obj = API
    Login(obj, 'username', 'password')
    Laminae(obj)
User avatar
ebarbero
 
Posts: 76
Joined: Mon May 21, 2012 11:24 am

Connect Using Mathematica

Postby ebarbero » Sat Aug 03, 2013 4:49 pm

  1. Run this code
    Code: Select all
    InstallService["http://www.cadec-online.com/API.asmx?WSDL"];
    Login["user", "password"];
    Fiber[Fibers[][[1, 1]]]
    Logout[];
User avatar
ebarbero
 
Posts: 76
Joined: Mon May 21, 2012 11:24 am

Plugins

Postby ebarbero » Sat Aug 03, 2013 5:28 pm

User avatar
ebarbero
 
Posts: 76
Joined: Mon May 21, 2012 11:24 am


Return to CADEC

Who is online

Users browsing this forum: No registered users and 1 guest