Get byte stream of a picture


Badge +2

Hi,

I would like to get the byte stream of a picture in order to save this stream into the AD attribute thumbnailPhoto via the use of the action "Update AD user"

So far I'm using the Copy.GetItem method and in general it looks quite promising...

 193986_pastedImage_1.png

193987_pastedImage_2.png

When running a test I can see the stream in the result box.

But when running the workflow it throws me the error...

Failed to invoke web service. 'undefined/undefined:m:Stream' has an invalid token
Variable Var_Picture_Bytes is Multiple lines of text.
Does anybody has an idea how to fix this?
Thank you

11 replies

Userlevel 5
Badge +14

there is something weird with your output configureation.

how did you get there 'undefined'?

there should be a xpath to an element (m:stream) you want to extract.

try to remove output configuration and set it up once again.

Badge +2

Hi Marian,

I did it several times and I also tried other attributes than m:Stream

But always the selected result is undefined:m:Stream.

Today I have implemented it within a list workflow not a site workflow because I thought maybe then the undefined will be replaced. But unfortunately same situation.

194035_pastedImage_2.png

As you can see I always get "undefined..." and not "/soap:Evelope/..." as you have.

Is there something which needs to be configured somewhere centrally?

Userlevel 5
Badge +14

it looks like it can not read or parse response definition from wsdl correctly.

can you post how does XML tree looks like in 'specify element' dialog?

try to directly read wsdl definition by putting   <site_URL>/_vti_bin/Copy.asmx?wsdl into browser and check definition of GetItem element and its response.

Badge +2

I have now put <site_URL>/_vti_bin/Copy.asmx?wsdl into the action but there is still "undefined" even after refreshing the method selection.

XML tree looks like this:

194039_pastedImage_1.png

I am able to read <site_URL>/_vti_bin/Copy.asmx?wsdl properly.

194040_pastedImage_4.png

Thank you

Userlevel 5
Badge +14

hm, that all seems to be correct....

have you tried to read ?wsdl with the same user credentials as you invoke web service?

if you try to get default value, does it work?

Badge +2

Yes I am using the same user.

When changing to the default value everything is fine without an error. Result is "0"

Userlevel 5
Badge +14

do you have a chance to call the web service from an other application/tool (like soapui)?

just to proof whether problem is at service side or at nintex side.

what workflow version are you on?

Badge +2

Hello Marian,

I have tried with soapui but without success --> "Unexpected end of file after null"

I have also found this thread with similar problem Call WebService action can't parse XML-schema 

My version is: Version: 3.1.6.0 - English, License type: Development (Enterprise)

Thank you

Userlevel 5
Badge +14

so you are on release from Oct 2015 and it's reported there to be resolved in Feb 2016 release 3.1.7.10

it looks your only option is to upgrade your env.

Badge +2

Well this might help. Thanks a lot for your help. I will report what happens after done the upgrade.

Badge +2

So far we haven’t implemented the upgrade jet but there is a temporary solution which helps for the time being.

 

Instead of using the "Call web service" action it is also possible to use the "Web request" action with which we can get the whole XML result.

 

When having the XLM result stored in a multiline variable I used the "Query XML" action to get the byte string.

 

Query XML allows to edit the XPath where the wrongly generated XPath

 

/soap:Envelope/undefined:soap:Body/defaultNS:GetItemResponse/defaultNS:Stream

 

can be modified to 

 

/soap:Envelope/soap:Body/defaultNS:GetItemResponse/defaultNS:Stream

Reply