Summary - I call a Web Service Initialise function and get returned a token that I can then use to call other functions.
The token is returned correctly and is a string of about 1000 characters. However, when I try and use the token I get error: “Input string was not in a correct format”.
When I print the string mySoap it is as it should be (the desired xml was supplied). I think it may be something to do with CDATA as the call to Initialise works and this has no data added to CDATA.
If it’s any use, here is the xml string for the working Initialise function:
StrToken is a string of around 1000 characters that is returned when I call the Initialise function. Sorry for the confusion but I did not want to over complicate this post.
Basically, I can use CDATA if there is no parameter but if there is a parameter then it doesn’t work. As I said, I know what the xml string should be.
Lets say I was to send the following string to the server:
If I now msgbox this string (MySoap) it looks correct but does not work. I suppose my question is - does domino add anything extra to CDATA or is it anything to do with the string being long (about 1000 characters). I have just used a short string above by way of an example.
You’re adding wihtespace (i.e. LF characters) in your sToken Tag and the CDATA section. While the web service may probably tolerate the extra whitespace in the sToken tag, it will definitely not like the extra LF in the CDATA section. Update your code to:
MySoap = Mysoap & Chr(10) & {}
MySoap = Mysoap & {<![CDATA[} & strToken
MySoap = Mysoap & {]]>}
MySoap = Mysoap & {}
Depending on the data of the token (does it contain non-ascii stuff?) you may want to ensure you’re printing the data with the same encoding specified in the XML header. (Lotusscript does not print UTF-8).
Solved. Bram was right about the spaces but I also had to remove Chr(10) references from my xml string when calling the GetDetails function i.e. when there was data in CDATA.
The Chr(10) commands did not cause a problem when calling the Initialise function (CDATA was empty).