Software Development Kit (SDK) and API Discussions

how to get ApiProxy work

canowuser8
2,499 Views

1>I compile “dfm-5.0.wsdl” (come from DFM SDK) and generate all soap files by using gsoap 2.7.9.

2> With the generated soap files, I made a simple program and try to retrieve info by accessing a DFM web service.     

I can make regular DFM calls work, such as “LunListInfoIterStart”,  “LunListInfoIterNext”, etc.

3>  But when I call “ApiProxy” soap call, for exmaple, to run  "system-get-info" on a storage controler,

it always returns error such as "Invalid tag" after a long time.     

In debug mode, I checked soap's buffer, it has all returned infomation of "system-get-info".

But the info doesn't show up in ApiProxy's repsonse result.      

The following is my simple code of calling "ApiProxy". Any suggestion:

int main (int argc, char *argv[])

if (argc < 4){      

printf("Usage: %s {NMSDK Server URL} {Username} {Password}\n", argv[0]);       return -1;   }  

else      

   printf("Connecting to NMSDK Server [%s] with user [%s].\n", argv[1], argv[2]);  

  std::string sURL = argv[1];  

  std::string sUsername = argv[2];  

  std::string sPassword = argv[3];  

  DfmBinding ClientSoap;  

  ClientSoap.soap->userid = soap_strdup(ClientSoap.soap, sUsername.c_str());  

  ClientSoap.soap->passwd = soap_strdup(ClientSoap.soap, sPassword.c_str());  

   ClientSoap.endpoint = sURL.c_str();   

  //memset(ClientSoap.soap->buf, 0, SOAP_BUFLEN);  

ClientSoap.soap->recv_timeout = 20;

ClientSoap.soap->send_timeout = 20;

ClientSoap.soap->connect_timeout = 20;

ClientSoap.soap->accept_timeout = 20;  

soap_ssl_init();  

if (soap_ssl_client_context (ClientSoap.soap, SOAP_SSL_NO_AUTHENTICATION,                                 NULL, NULL, NULL, NULL, NULL) != SOAP_OK){      

     printf("soap_ssl_client_context() failed.");   }    

  int iRc;  

printf("api-proxy: system-get-info\n");  

printf("---------------------------------------------------------------------------:\n");   

ClientSoap.soap->userid = soap_strdup(ClientSoap.soap, sUsername.c_str());  

ClientSoap.soap->passwd = soap_strdup(ClientSoap.soap, sPassword.c_str()); 

_ns1__ApiProxy *apiProxy = soap_new__ns1__ApiProxy(ClientSoap.soap, -1);  

apiProxy->Target.assign("netappone");  

apiProxy->Request = soap_new_ns1__Request(ClientSoap.soap, -1);  

apiProxy->Request->Name.assign("system-get-info");  

apiProxy->Request->Args = soap_new__ns1__Request_Args(ClientSoap.soap, -1);    

  _ns1__ApiProxyResult *apiProxyResult = soap_new__ns1__ApiProxyResult(ClientSoap.soap, -1); 

if ((iRc = ClientSoap.__ns1__ApiProxy(apiProxy, apiProxyResult)) == 0){     

           if(!apiProxyResult->Response->Status.compare("passed"))       {       

              printf("---------------------------------------------------------------------------:\n");     

            }       else     

            {       

                 printf("-----------------------api-proxy call failed 1 -------------------------------:\n");     

            }  

         }   else  

          {      

             printf("-----------------------api-proxy call failed 2  --------------:\n"); 

         }  

}

0 REPLIES 0
Public