wsman invoke

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

wsman invoke

George Varghese
Hi,

I had implemented one provider. This provider have one method named SetActive(uint32 newval)

I had checked the validation in provider for this function parameters looks like below,


    // Check new val
    if (!newval->exists || newval->null) {
        KSetStatus2(_cb, status, ERR_INVALID_PARAMETER, "Input value is not defined.");
        KUint32_Set(&result, 1);
        return result;
    }


 I have tested it via wbemcli commandline tool. its working.
Then I try to test it via wsman, I don't know how to pass the parameter value here.

I have tried ,

wsman invoke -a "SetActive" http://dummy.com//wbem/wscim/1/cim-schema/2/GK_Input -k "newval=1"

After executing it, I got the following response, that was it I checking input parameters,

<s:Fault>
      <s:Code>
        <s:Value>s:Sender</s:Value>
        <s:Subcode>
          <s:Value>wsman:InvalidParameter</s:Value>
        </s:Subcode>
      </s:Code>
      <s:Reason>
        <s:Text xml:lang="en">Input value is not defined.</s:Text>
      </s:Reason>
      <s:Detail>
        <wsman:FaultDetail>http://schemas.dmtf.org/wbem/wsman/1/wsman/faultDetail/MissingValues</wsman:FaultDetail>
      </s:Detail>
    </s:Fault>

Could you please tell me, how to invoke a method with giving values via wsman.

Regards,
George




Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

Klaus Kaempf
* George Varghese <[hidden email]> [Aug 02. 2013 11:24]:
>
>  I have tested it via wbemcli commandline tool. its working.
> Then I try to test it via wsman, I don't know how to pass the parameter
> value here.
>
> I have tried ,
>
> wsman invoke -a "SetActive"
> http://dummy.com//wbem/wscim/1/cim-schema/2/GK_Input -k "newval=1"

The -k option of wsman sets property keys. Property keys are used to
specify a resource.

Passing invoke function arguments works via selectors. However, this
is currently not supported in wsmancli.


Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

George Varghese

I didn't get it.

I have test it via wbemcli client ,

$wbemcli cm http://localhost:5988/root/cimv2:GK_Input SetActive.newval=1

its working..

How to test it via wsman?

Have any other option?

Regards,
George
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

George Varghese

I have tried it another way,

$wsman invoke -a "SetActive" http://dummy.com//wbem/wscim/1/cim-schema/2/GK_Input -J input.xml

contents of the input.xml file ,

<p:SetActive_INPUT xmlns:p="http://dummy.com//wbem/wscim/1/cim-schema/2/GK_Input">
<p:newval>1</p:newval>
</p:SetActive_INPUT>


but the error is still remains..

How to invoke it via wsman?

Regards,
George
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

Klaus Kaempf
In reply to this post by George Varghese
* George Varghese <[hidden email]> [Aug 02. 2013 11:57]:

>
> I didn't get it.
>
> I have test it via wbemcli client ,
>
> $wbemcli cm http://localhost:5988/root/cimv2:GK_Input SetActive.newval=1
>
> its working..
>
> How to test it via wsman?

wsman does not currently support passing of selectors (aka function
arguments).

>
> Have any other option?

- try another ws-management client lib, like this one:
  https://github.com/WinRb/WinRM
- use the Openwsman client bindings to write a specific client
  See https://github.com/Openwsman/openwsman/tree/master/bindings
  and esp. the <language>/test directories below for examples
- provide a patch to wsman


Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

Klaus Kaempf
In reply to this post by George Varghese
* George Varghese <[hidden email]> [Aug 02. 2013 12:54]:
>
> I have tried it another way,
>
> $wsman invoke -a "SetActive"
> http://dummy.com//wbem/wscim/1/cim-schema/2/GK_Input -J input.xml
>
> contents of the input.xml file ,

This influences the <body> of the WS-Management request. However,
selectors are passed via the <header>.

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

George Varghese
Hi,

I tried it via winrm. but no hope. Please help me for invoke a method via winrm/wsman.
I copied here the commmands and response.

C:\Documents and Settings\Administrator> winrm i SetActive root/cimv2:GK_Test  -u:admin -p:secret -r:http://10.1.125.42:5985/wsman -SkipCNcheck -SkipCAcheck -encoding:utf-8 -a:digest
@{SetActive.newval="48"}
WSManFault
    Message = The WinRM client sent a request to the remote WS-Management servic
e and got a response saying the service is unavailable. This is usually a tempor
ary failure which means if you try again later the service may be available.

Error number:  -2144108270 0x80338112
The WinRM client sent a request to the remote WS-Management service and got a re
sponse saying the service is unavailable. This is usually a temporary failure wh
ich means if you try again later the service may be available.


serial console log :-


-sh-3.00#
-sh-3.00#
-sh-3.00#
-sh-3.00# Jan  1 09:09:50 [2934] 10.1.125.42:5985 connected (socket 7)
Jan  1 09:09:50 [2934] Conn 7: parsing request: [POST /wsman HTTP/1.1
Content-Type: application/soap+xml;charset=UTF-8
User-Agent: Microsoft WinRM Client
Host: 10.1.125.42:5985
Content-Length: 1039
Connection: Keep-Alive

]
Jan  1 09:09:50 [2934] parsing headers (len 158): [Content-Type: application/soap+xml;charset=UTF-8
User-Agent: Microsoft WinRM Client
Host: 10.1.125.42:5985
Content-Length: 1039
Connection: Keep-Alive

]
Jan  1 09:09:50 [2934] decide_what_to_do: [/wsman]
Jan  1 09:09:50 [2934] is_alias: aliases []
Jan  1 09:09:50 [2934] 7 (null) stopped. 0 of content data, 206 now in a buffer
Jan  1 09:09:50 [2934] Disconnecting 7 (Keep-Alive)
Jan  1 09:09:50 [2934] 10.1.125.42:5985 connected (socket 7)
Jan  1 09:09:50 [2934] Conn 7: parsing request: [POST /wsman HTTP/1.1
Content-Type: application/soap+xml;charset=UTF-8
User-Agent: Microsoft WinRM Client
Host: 10.1.125.42:5985
Content-Length: 1039
Connection: Keep-Alive
Authorization: Digest username="admin", realm="OPENWSMAN", qop="auth", algorithm="MD5", uri="/wsman", nonce="13190", nc=00000001, cnonce="aa7de4063fe32373a425da597c0a47a5", response="a76b3df3dbd7d30f86d24cdd706ac0e2"

]
Jan  1 09:09:50 [2934] parsing headers (len 376): [Content-Type: application/soap+xml;charset=UTF-8
User-Agent: Microsoft WinRM Client
Host: 10.1.125.42:5985
Content-Length: 1039
Connection: Keep-Alive
Authorization: Digest username="admin", realm="OPENWSMAN", qop="auth", algorithm="MD5", uri="/wsman", nonce="13190", nc=00000001, cnonce="aa7de4063fe32373a425da597c0a47a5", response="a76b3df3dbd7d30f86d24cdd706ac0e2"

]
Jan  1 09:09:50 [2934] decide_what_to_do: [/wsman]
Jan  1 09:09:50 [2934] is_alias: aliases []
Jan  1 09:09:50 [2934] auth field [admin]
Jan  1 09:09:50 [2934] auth field [OPENWSMAN]
Jan  1 09:09:50 [2934] auth field [auth]
Jan  1 09:09:50 [2934] auth field [MD5]
Jan  1 09:09:50 [2934] auth field [/wsman]
Jan  1 09:09:50 [2934] auth field [13190]
Jan  1 09:09:50 [2934] auth field [00000001]
Jan  1 09:09:50 [2934] auth field [aa7de4063fe32373a425da597c0a47a5]
Jan  1 09:09:50 [2934] auth field [a76b3df3dbd7d30f86d24cdd706ac0e2]
Jan  1 09:09:50 [2934] parse_htpasswd_line: [admin] [OPENWSMAN] [cec88d2992fbbd85ce8e564427c316f7]
Jan  1 09:09:50 [2934] [admin] [OPENWSMAN] [cec88d2992fbbd85ce8e564427c316f7]
Jan  1 09:09:50 [2934] Done reading request
Jan  1 09:09:50 [2934] Inbound call...
Jan  1 09:09:50 [2934] uri: root/cimv2:GK_Test, action: root/cimv2:GK_Test/SetActive
Jan  1 09:09:50 [2934] namespace: http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
Jan  1 09:09:50 [2934] namespace: http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2
Jan  1 09:09:50 [2934] namespace: http://schemas.dmtf.org/wbem/wscim/1
Jan  1 09:09:50 [2934] namespace: http://schemas.openwsman.org/wbem/wscim/1/intrinsic
Jan  1 09:09:50 [2934] namespace: http://schema.dummy.com//wbem/wscim/1/cim-schema/2
Jan  1 09:09:50 [2934] namespace: http://schema.omc-project.org/wbem/wscim/1/cim-schema/2
Jan  1 09:09:50 [2934] namespace: http://schema.openpegasus.org/wbem/wscim/1/cim-schema/2
Jan  1 09:09:50 [2934] namespace: http://schema.dummy.com//wbem/wscim/1/cim-schema/2
Jan  1 09:09:50 [2934] namespace: http://schema.openwbem.org/wbem/wscim/1/cim-schema/2
Jan  1 09:09:50 [2934] Dispatcher Error
Jan  1 09:09:50 [2934] dispatch == NULL
Jan  1 09:09:50 [2934] Fault Code: 9
Jan  1 09:09:50 [2934] destroy op
Jan  1 09:09:50 [2934] nothing to destroy...
Jan  1 09:09:50 [2934] Inbound call completed
Jan  1 09:09:50 [2934] Response status=503 ((null))
Jan  1 09:09:50 [2934] 7 (null) stopped. 1119 of content data, 1119 now in a buffer
Jan  1 09:09:50 [2934] Disconnecting 7 (Keep-Alive)
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

George Varghese
Hi,

In software update profile spec, specified the return codes for some methods like InstallFromURI.
Value             Description
0                   Request was successfully executed.
1                   Method is not supported in the implementation.
2                   Error occurred.
4096              Job started: REF returned to started CIM_ConcreteJob

In provider , I set proper value to this ,

 valrc.uint32 = 2;
 CMReturnData( rslt, &valrc, CMPI_uint32);
 CMReturnDone( rslt );

But I didn;t get the response code as 2 in to the wsman soap response when the request was failed in provider. I got the proper fault response with error code is 400 or 503..

Is it the expected format?

Regards,
George

Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

Klaus Kaempf
* George Varghese <[hidden email]> [Jul 15. 2014 15:58]:

> Hi,
>
> In software update profile spec, specified the return codes for some methods
> like InstallFromURI.
> Value             Description
> 0                   Request was successfully executed.
> 1                   Method is not supported in the implementation.
> 2                   Error occurred.
> 4096              Job started: REF returned to started CIM_ConcreteJob
>
> In provider , I set proper value to this ,
>
>  valrc.uint32 = 2;
>  CMReturnData( rslt, &valrc, CMPI_uint32);
>  CMReturnDone( rslt );
>
> But I didn;t get the response code as 2 in to the wsman soap response when
> the request was failed in provider.

How does the response you got look like ?

Return values from method invocations should be returned as
{methodname}_OUTPUT xml tags in the WS-Management response.

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

George Varghese
Hi,

if the request is successfully executed, then I will got response is correctly as you mentioned here. other wise the response is not correct.

In provider , I set the below enum.

CMSetStatusWithChars(_broker, &rc, CMPI_RC_ERR_FAILED, "Failed to processing");   


After wsman soap request, I got the following response, if any error occurred.



Regards,
George


On Tue, Jul 15, 2014 at 7:54 PM, Klaus Kaempf <[hidden email]> wrote:
* George Varghese <[hidden email]> [Jul 15. 2014 15:58]:
> Hi,
>
> In software update profile spec, specified the return codes for some methods
> like InstallFromURI.
> Value             Description
> 0                   Request was successfully executed.
> 1                   Method is not supported in the implementation.
> 2                   Error occurred.
> 4096              Job started: REF returned to started CIM_ConcreteJob
>
> In provider , I set proper value to this ,
>
>  valrc.uint32 = 2;
>  CMReturnData( rslt, &valrc, CMPI_uint32);
>  CMReturnDone( rslt );
>
> But I didn;t get the response code as 2 in to the wsman soap response when
> the request was failed in provider.

How does the response you got look like ?

Return values from method invocations should be returned as
{methodname}_OUTPUT xml tags in the WS-Management response.

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

Klaus Kaempf
* George varghese <[hidden email]> [Jul 16. 2014 11:17]:
> Hi,
>
> if the request is successfully executed, then I will got response is
> correctly as you mentioned here. other wise the response is not correct.
>
> In provider , I set the below enum.

Well, if you call this in your provider:

>
> CMSetStatusWithChars(_broker, &rc, CMPI_RC_ERR_FAILED, "Failed to
> processing");
>
>
> After wsman soap request, I got the following response, if any error
> occurred.

Then this response it to be expected:

>
> error response - https://gist.github.com/georgooty/d87272a0052af903ee27
>
> success response -
> https://gist.github.com/georgooty/e025910d01f7a3250f39#file-invokemethod_successful_response
>

Where's the bug ?

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

George Varghese
In spec specifying the below codes,

> In software update profile spec, specified the return codes for some methods
> like InstallFromURI.
> Value             Description
> 0                   Request was successfully executed.
> 1                   Method is not supported in the implementation.
> 2                   Error occurred.
> 4096              Job started: REF returned to started CIM_ConcreteJob

If request is fails, I didn't see the code as 2 in response, https://gist.github.com/georgooty/d87272a0052af903ee27

is it the expected result, ?

Regards,
George




On Wed, Jul 16, 2014 at 2:58 PM, Klaus Kaempf <[hidden email]> wrote:
* George varghese <[hidden email]> [Jul 16. 2014 11:17]:
> Hi,
>
> if the request is successfully executed, then I will got response is
> correctly as you mentioned here. other wise the response is not correct.
>
> In provider , I set the below enum.

Well, if you call this in your provider:

>
> CMSetStatusWithChars(_broker, &rc, CMPI_RC_ERR_FAILED, "Failed to
> processing");
>
>
> After wsman soap request, I got the following response, if any error
> occurred.

Then this response it to be expected:
Where's the bug ?

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|

Re: wsman invoke

Klaus Kaempf
* George varghese <[hidden email]> [Jul 16. 2014 11:55]:

> In spec specifying the below codes,
>
> > In software update profile spec, specified the return codes for some
> methods
> > like InstallFromURI.
> > Value             Description
> > 0                   Request was successfully executed.
> > 1                   Method is not supported in the implementation.
> > 2                   Error occurred.
> > 4096              Job started: REF returned to started CIM_ConcreteJob
>
> If request is fails, I didn't see the code as 2 in response,
> https://gist.github.com/georgooty/d87272a0052af903ee27

Ah, I see.

>
> is it the expected result, ?

Actually, yes. WS-Management reports failure via WS-Fault, which has a
fixed structure of code, subcode, detail, and reason.
There is no means of transporting the CMPIStatus rc code via WS-Fault.
Only the CMPIStatus msg string is reporting via WS-Fault 'reason'.

Klaus
--
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg)
Maxfeldstraße 5, 90409 Nürnberg, Germany

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel