|
Loading
|
CADEC
:
Help
:
API
Try the new CADEC Web Service!
This feature allows you to use your CADEC objects in other platforms such as
Abaqus®
,
Matlab®,
Python,
.NET,
Mathematica®, etc.
This interface is experimental, so any feedback is appreciated.
- Connect using Abaqus
-
- Download
PySimpleSOAP
- Open client.py, change line 103, from this
self.http = Http(timeout=TIMEOUT, cacert=cacert, proxy=proxy, sessions=sessions)
to this:
self.http = Http(cacert=cacert, proxy=proxy, sessions=sessions)
- Save client.py
- Copy pysimplesoap folder to C:\SIMULIA\Abaqus\[Abaqus Version]\Python\Lib\
- Start Abaqus CAE
- Run this code in the prompt
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()
- Connect using C#
-
- Create a Console application
- In Solution Explorer, References, Add Service Reference
- Click in Advanced...
- Click in Add Web Reference...
- in URL type http://www.cadec-online.com/API.asmx
- in Web Reference Name type CADEC
- Type this code
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();
- Connect Using Matlab
-
- Write callSoapService, select the word, right click, Open
- Write global cookie; just bellow the documentation
- Write this below %Set
the appropriate HTTP parameters.
if (~isempty(cookie))
httpConn.setRequestProperty('Cookie', concat(concat(cookie.Name,'='),cookie.Value))
end
- Write this bellow byteArrayOutputStream.close;
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
- Save callSoapService
- Write this in the prompt
createClassFromWsdl('http://www.cadec-online.com/API.asmx?WSDL')
obj = API
Login(obj, 'username', 'password')
Laminae(obj)
- Connect Using Mathematica
-
- Run this code
InstallService["http://www.cadec-online.com/API.asmx?WSDL"];
Login["user", "password"];
Fiber[Fibers[][[1, 1]]]
Logout[];
Try it at
API
|