Highlighted
abhilas945
1 Nickel

celerra or vnx-file xml api login example

Hi All,

I am trying to use the celerra xml api to query the system and get some information. As per the help guide I first need to perform the http login and then use the cookie for all the next xml quires. But I am unable to make the login, the help guide is not at all descriptive enough for me.

The error I am getting is "The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel" when tried from my c# program. Also I tried to use HttpRequester & Poster firefox tools to login, I am getting "403 Forbidden. Session timeout. Relogin and try this operation again." error here.

So can anyone help here please.

Regards,

Abhilash.

Labels (5)
0 Kudos
10 Replies
Rainer_EMC
5 Rhenium

Re: celerra or vnx-file xml api login example

Hi,

do you still have a problem there ?

0 Kudos
abhilas945
1 Nickel

Re: celerra or vnx-file xml api login example

Hi,

Yes, I am still unable to find a way to use this API. I am doing an working around by using SSH, but still the API is the best way for my application.

Any help here would be very useful to me.

Regards,

Abhilash.

MaBerY
1 Copper

Re: Re: celerra or vnx-file xml api login example

I got the example code working posted in https://community.emc.com/message/921930#921930 written by john mcgeever.

Most of the code is well written and understandable, but I have some problems interpret the Class defenitions for the responsePacket object. I was not able to iterate trough the object items.

I was able to serialize it back to a text string usung the Xml serializer:

System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(responsePacket.GetType()); 

x.Serialize(Console.Out, responsePacket);

I could not figure out how to map it to the defined  FileSystemQueryParams class.

Has anyone have a clue how to interpret the resonse object

0 Kudos
Rainer_EMC
5 Rhenium

Re: Re: celerra or vnx-file xml api login example

below is the schema definition of the responsePacket - does that help ?

Rainer

----

<?xml version="1.0" encoding="UTF-8"?>

<schema targetNamespace="http://www.emc.com/schemas/celerra/xml_api"

    elementFormDefault="qualified" attributeFormDefault="unqualified"

    xmlns="http://www.w3.org/2001/XMLSchema"

    xmlns:meta="http://www.emc.com/schemas/celerra/xml_api_meta"

    xmlns:api="http://www.emc.com/schemas/celerra/xml_api">

   

    <include schemaLocation="BasicTypes.xsd"/>

    <include schemaLocation="Query.xsd"/>

    <include schemaLocation="QueryStats.xsd"/>

    <include schemaLocation="Task.xsd"/>

    <!--*********************************************************************************************************-->

    <complexType name="Response">

        <annotation>

            <documentation>

                Specifies an object that is a response to the corresponding request object from the request packet.

            </documentation>

        </annotation>

        <choice>

            <group ref="api:QueryResponseChoice" minOccurs="0" maxOccurs="unbounded"/>

            <group ref="api:QueryStatsResponseChoice"  minOccurs="0" maxOccurs="unbounded"/>

            <element name="TaskResponse" type="api:TaskResponse"/>

            <element name="Fault" type="api:Status"/>

        </choice>

        <attribute name="clientHandle" type="api:ClientHandle" use="optional">

            <annotation>

                <documentation>

                    Defines an optional string that is an exact copy of the attribute 'clientHandle' of

                    the corresponding request structure. If the request object did not have the 'clientHandle'

                    attribute, this attribute does not occur.

                </documentation>

            </annotation>

        </attribute>

    </complexType>

    <!--*********************************************************************************************************-->

    <complexType name="ResponseEx">

        <annotation>

            <documentation>

                Specifies an object that is a response to the corresponding request object from the request packet.

            </documentation>

        </annotation>

        <choice>

            <group ref="api:QueryResponseChoiceEx" minOccurs="0" maxOccurs="unbounded"/>

            <group ref="api:QueryStatsResponseChoiceEx" minOccurs="0" maxOccurs="unbounded"/>

            <element name="TaskResponse" type="api:TaskResponse"/>

            <element name="Fault" type="api:Status"/>

        </choice>

        <attribute name="clientHandle" type="api:ClientHandle" use="optional">

            <annotation>

                <documentation>

                    Defines an optional string that is an exact copy of the attribute 'clientHandle' of

                    the corresponding request structure. If the request object did not have the 'clientHandle'

                    attribute, this attribute does not occur.

                </documentation>

            </annotation>

        </attribute>

    </complexType>

    <!--*********************************************************************************************************-->

    <element name="ResponsePacket">

        <annotation>

            <documentation>

                Defines a response packet that is a top-level element of the XML contained in the body of the

                HTTP POST reply.

            </documentation>

        </annotation>

        <complexType>

            <choice>

                <choice  minOccurs="0" maxOccurs="unbounded">

                    <element name="Response" type="api:Response">

                        <annotation>

                            <documentation>

                                Defines a response element that corresponds to the appropriate request element

                                in the request packet.

                            </documentation>

                        </annotation>

                    </element>

                    <element name="ResponseEx" type="api:ResponseEx">

                        <annotation>

                            <documentation>

                                Defines the an extended response element that corresponds to the

                                appropraite extended request element.

                            </documentation>

                        </annotation>

                    </element>

                </choice>

                <element name="PacketFault" type="api:Status">

                    <annotation>

                        <documentation>

                            Defines a fault that can not be attributed to any request, but is related more to

                            to the entire packet. For example, the message that was supposed to be a

                            request packet could not be parsed according to XML or defined schema rules.

                        </documentation>

                    </annotation>

                </element>

            </choice>

            <attribute name="apiVersion" type="api:APIVersion" use="optional" default="V1_0">

                <annotation>

                    <documentation>

                        Specifies the API version of the response packet.

                    </documentation>

                </annotation>

            </attribute>

            <attribute name="time" type="api:PreciseUtcTime" use="optional">

                <annotation>

                    <documentation>

                        Specifies the time on the Control Station at the moment when

                        it generated the reply.

                        This attribute is present only when the request packet

                        contains no requests (empty packet). By measuring the roundtrip

                        time of an empty packet and using the value of this attribute,

                        the user application can determine the time on

                        the Control Station server with a relatively good precision.

                    </documentation>

                </annotation>

            </attribute>

        </complexType>

    </element>

</schema>

0 Kudos
shivadaimler
1 Nickel

Re: celerra or vnx-file xml api login example

Hi Rainer,

I  have a query i need one API CifsShareQueryParams to be used to query , my question how should i use this below schema or should i import to VNX? how can i achieve this,

<complexType xmlns="http://www.w3.org/2001/XMLSchema" name="CifsShareQueryParams">

    <annotation>

        <documentation>Defines parameters for the query that retrieves CIFS share objects.</documentation>

    </annotation>

    <sequence>

        <element name="MoverOrVdm" type="api:MoverOrVdmRef" minOccurs="0">

            <annotation>

                <documentation>Specifies a mover or a VDM.

                        If this element occurs, filter out shares that reside

                        on this mover or VDM.</documentation>

            </annotation>

        </element>

    </sequence>

    <attribute name="cifsServer" type="api:NetBiosName" use="optional">

        <annotation>

            <documentation>Specifies a CIFS server NETBIOS name. If not specified, all shares

                    for the specified mover or VDM are retrieved.</documentation>

        </annotation>

    </attribute>

    <attribute name="name" type="api:CifsShareName" use="optional">

        <annotation>

            <documentation>Specifies a share name. If not specified, all shares on the specified mover/CIFS server

                    are retrieved.</documentation>

        </annotation>

    </attribute>

</complexType>

0 Kudos
Rainer_EMC
5 Rhenium

Re: celerra or vnx-file xml api login example

the Schema is merely a help (documentation) for programmers to understand the namespace and syntax of the API

There is NO NEED to install it on the VNX.

0 Kudos
cking220011
1 Copper

Re: celerra or vnx-file xml api login example

Not sure if you need more and I hate to beat a dead horse. I have a bunch of scripts to find shares, get qtrees and quota usage and raise quotas, create qtrees and shares, etc. Once you get past the first step this all is very useful an do-able.

Here is an old sample I posted a while back using PowerShell. I did try similar with C# while debugging in my early efforts but don't have that code and don't recall what I used to do the http posts/etc.

This might need some fleshing out but it works. One thing I do have to do is import the certificate (to computer account store) as we have a self-signed certificate.

It is basically how I do things today though I we now use LDAP. I have some code for that if needed.

get-nas-cifs-share.ps1

0 Kudos
Rainer_EMC
5 Rhenium

Re: celerra or vnx-file xml api login example

Hi Chris,

always good to have examples posted.

Keep in mind though that the original post was about the VMX API and not Powershell.

Rainer

0 Kudos
cking220011
1 Copper

Re: celerra or vnx-file xml api login example

I guess I don't understand. I think he is asking about using the xml api which I am calling via PowerShell.

Frankly, I think he is trying to do exactly what I do though he might not be trying via PowerShell.(sounds like C#)

-c

0 Kudos