How to call WS-translator service methods by code?

How to call WS-translator service methods by code?

That's the question.

Many thanks.

Javier Andrs

21 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hello there,

This sample code shows how to call the Ws-Translator methods by code; in the sample the data being post is a Ws-Man command in its body the wsa:to tag points the AMT destination machine (running AMT 2.X version), but when creating the WebRequest I point to machine running the ws-translator service.

Is this OK?

Many thanks.

string url = "http://desarrollo2/wstrans";

string postData = @"<?xml version='1.0' encoding='UTF-8'?>http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumeratehttp://192.16...";

HttpWebRequest r = null;

CredentialCache myCache = new CredentialCache();

myCache.Add(new System.Uri(url), "Digest", new NetworkCredential(user, pass));

try

{

r = (HttpWebRequest)HttpWebRequest.Create(url);

r.PreAuthenticate = true;

//r.ConnectionGroupName = _address;

r.Timeout = 3000;

r.Credentials = myCache;

byte[] data = UTF8Encoding.UTF8.GetBytes(postData);

r.Method = "POST";

r.ContentType = "application/soap+xml;charset=UTF-8";

r.ContentLength = data.Length;

r.Referer = "";

Stream s = r.GetRequestStream();

s.Write(data, 0, data.Length);

s.Close();

}

catch (IOException) { }

HttpWebResponse rr = null;

try

{

rr = (HttpWebResponse)r.GetResponse();

XmlDocument xDoc = new XmlDocument();

Stream inStream = rr.GetResponseStream();

xDoc.Load(inStream);

}

catch (WebException ex)

{

}

The wsa:to tag should reference the address of the translator itself. The translator will replace the wsa:to tag with the AMT address if necessary when forwarding messages on to AMT devices.

Translator URLscontain routing information in the url path itself:

/wstrans/{routing information}/wsman

The routing information for the translator consists of the following path elements:

./wstrans/{RouteType}/{VersionType}/{TargetDevice}/wsman

RouteType can be one of the following values:

pro pro routing is the standard vpro routing. Use this routing for devices that are already provisioned

setup setup routing is used to send messages to devices that are in provisning mode. The translator will forward messages using either PSK/Setup routing or PKI/Setup routing

dsc discovery routing is used if the state of the device is not known. In this case the translator will attempt all routing types to deliver the message (both setup and pro routing will be attempted).

VersionType can be one of the following values:

eoi20 The translator utilize AMT 2.0 resources for translation:

eoi25 the translator will utilize AMT 2.5 resources for translation

wsman the translator will not perform translation but will forward the wsman request on to the device

TargetDevice

This is the FQDN or IP address of the AMT device you want to send messages too. If you are using TLS or Kerberos authentication then you will need to use the FQDN of the AMT device. For setup routing, or non-TLS/non-Kerberos connections you can us the IP address.

Examples of Translator Urls:

https://mytranslatorhost/wstrans/pro/eoi20/MyAMT2Box.vprodemo.com/wsman

https://mytranslatorhost/wstrans/setup/eoi20/192.168.0.100/wsman

https://mytranslatorhost/wstrans/dsc/eoi20/MyAMT25Box.vprodemo.com/wsman

https://mytranslatorhost/wstrans/pro/eoi25/MyAMT25Box.vprodemo.com/wsman

https://mytranslatorhost/wstrans/pro/wsman/MyAMT3Box.vprodemo.com/wsman

Randy Templeton

IntelSoftware Engineer/Translator developer

Hello Randy,

Many thanks for this great information.

But I have now another issue for clarifying: for using WS-Trans it's necesary knowing the target AMT machine version for pointing the rigth EOI version, is it?

And I have another question: in the case when SCS is used, then credentials must be ask to that service; How can I access the SCS web serviceto get credentials for a guven AMT machine?, I mean, Is there a programming interface for it (a SOAP API)?

Many thanks,

Javier Andrs

The version path information tells the translator what APIs it can use when performing the translation. Since the eoi20 calls are supported on all versions of AMT2.x , you can use the eoi20 route information for all AMT2x communication. In other words, you can use eoi20 even if youre talking to AMT 2.2, 2.5, or 2.6 devices. However, if your using eoi20 to talk to an eoi25 compatible machine, just keep in mind that translator may be using deprecated or old versions of the eoi interface in some instances. If youre performing general AMT operations this will likely not be an issue. On the other hand, if you are trying to do mobile specific functions (like setup AMT wireless profile) you may have issues using eoi20 path information.

A common flow is to store the state and version of AMT in a discovery record (database or cache). However, you can query this information on the fly if it is not already known.

For example you can use /dsc/eo20/.. to query the CIM_SoftwareIdentiy where InstanceID=AMT to get the version. Querying the version using eoi20 is guaranteed to work for all versions of AMT.

You can also use use ../dsc/eo20/.. to query the instance of AMT_SetupAndConfigurationService to get the AMT communicationpath needed. If the Provisioning state property is 1 then you need to use setup routing, otherwise (if its 2") use pro routing.

Once you have obtainedthe information above you can storeit in a database so you dont have to keep asking the device every time you want to use the translator. If youre using the Intel SCS this information will already be stored in its database.

You can use the Intel SCSs SOAP API to get credentials for a specific AMT machine (but not using WsMan).

See the Configuration Service SOAP API (comes with the SCS)

GetAmtAdminPasswords

Randy

Hello Randy,

Thank you very much.

I saw the specification and GetAmtAdminPasswords hasoneinstruct paramete made ofan AMTIDTypes type (which one is made of the FQDN and the UUID) anda string ID; the last one is an identity string,butwheredoes it come from?

Many thanks again,

Javier Andrs

Hi,

We are working on this. Will get back to you soon.

Thanks,

Sree

Ok I will be waiting for.

Many thanks,

Javier Andrs

Hello Sree,

Nothing yet?

Javier Andrs

Hi Javier,

We are still working with the SCS support for getting an answer. Sorry for the delay.

Thanks,

Sree

Ok I will be waiting for.

Many thanks,

Javier Andrs

Javiar

Im still coming up to speed on SCS myself, but heres my understanding of the GetAMTAdminPasswords function.

One Argument in, AMTID (of AMTIDType), which has two components:

  • Type enumerated string, this can be either AMTIdUUID or AMTIdFQDN
  • ID string, the actual UUID or fully qualified domain name for the box

One argument out, Response (of type AmtAdminPasswords), which has two components:

  • MEBxPassword string, the MEBx password of the specified system
  • NetworkPassword string, the Network password of the specified system

To call the function you would select the type based on whether you were passing the UUID or the FQDN, and then the ID would be the actual value of the UUID or FQDN (for the UUID case, ID would be XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX, where the Xs would of course be replaced with a valid UUID). Assuming that SCS has an AMTRecord with that UUID, youll get back the AMTAdminPasswords structure with the elements listed above.

You can also use the GetAMTList SOAP API function (and the other related GetList functions) to get AMT information including the UUIDs from SCS in the first place.

Andy

Hello Andy,

Is it necessary start a session or log in for calling any SCS web method?

Many thanks,

Javier Andrs

Yes, for both of the functions starting a session would be required.

Hello Andy,

And what's the SCSlogin web method?

Many thanks,

Hi Javier,

We will get back to you soon.

Thanks,

Sree

Thanx Sree,

this really helped me too -thx

Hello Sree,

It's just to keep the thread.

Thanks.

Javier Andrs

Javier,

Sorry for the delayed response, I was trying to come up with a definitive response. I know you will need to use the Login function, but at the moment I can't describe to you in detail exactly how you would do so.

The best code example I can think of is for the SCS Console, which can be obtained as part of the SCS download (you can find it on the Downloads page, just search for Setup and Configuration Service). It is using the SOAP API to connect to the SCS service and perform various functions, so it should be helpful to you for other examples as well.

Hello Andy,

I have found in the Authentication Service SOAP APIthe Login method (with no inparameters), which one uses HTTP negotiate authentication and it's required for using other web calls.

Many thanks,

Javier Andrs

Leave a Comment

Please sign in to add a comment. Not a member? Join today