r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

Davide
30-Jun-2010
[3833]
This could be handy :

>> head insert #{} [1 2 3 4]
** Script error: invalid argument: [1 2 3 4]
** Where: insert
** Near: insert #{} [1 2 3 4]
Rebolek
30-Jun-2010
[3834]
Yes. If it's not in CureCode, you should put it there.
BrianH
30-Jun-2010
[3835x4]
R3 has that behavior as well. Don't know how likely it would be to 
add to R2, but if it is added with R3 behavior it would be helpful.
Or rather, R3 has the ability to insert blocks into binaries, not 
the ability to complain about it and trigger an error as in your 
example :)
>> head insert #{} [1 2 3 4]
== #{01020304}
We don't yet have a CureCode project for R2.
Steeve
30-Jun-2010
[3839]
Alternative way R2/R3
>> to-binary to-tuple [1 2 3 4]
== #{01020304}
BrianH
30-Jun-2010
[3840]
Nice! But you have to do it in sections of 10 or less, due to the 
length of tuples; not a complaint, a gotcha to look out for.
Steeve
30-Jun-2010
[3841x4]
12 for R2
11, sorry
now i'm wrong, 10
... look at the red light.
FLASH !!!!!!!!!!!!!!!!!!!
jack-ort
2-Jul-2010
[3845]
Hello - hope someone can find the newbie mistake I'm making here. 
 Wanted to use REBOL to tackle a need to get data from Salesforce 
using their SOAP API.  New to SOAP, WSDL and Salesforce, but using 
SoapUI mananged to do this POST (edited only to hide personal info):

POST https://login.salesforce.com/services/Soap/u/19.0HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.1
Host: login.salesforce.com
Content-Length: 525


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:partner.soap.sforce.com">
   <soapenv:Header>
      <urn:CallOptions>
         <urn:client></urn:client>
         <urn:defaultNamespace></urn:defaultNamespace>
      </urn:CallOptions>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>[jort-:-xxxxxxxxxxxxx-:-com]</urn:username>

         <urn:password>xxxxxxxxxx78l6g7iFac5uaviDnJLFxxxxx</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>

and get the desired response:

HTTP/1.1 200 OK
Server: 
Content-Encoding: gzip
Content-Type: text/xml; charset=utf-8
Content-Length: 736
Date: Fri, 02 Jul 2010 20:32:14 GMT


<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><loginResponse> 
......

Then using SoapUI I am able to send a successful Logout message.


Using REBOL 2.7.7.3.1, I created an "upload" string containing the 
POST block above without the "POST " at the beginning, set my url 
to:

>> url
== https://login.salesforce.com/services/Soap/u/19.0

and tried this:

>> response: read/custom url reduce ['POST upload]

but consistently get a Server 500 error:


** User Error: Error.  Target url: https://login.salesforce.com:443/services/Soap/u/19.0 
could not be retrieved.  Se
rver response: HTTP...
** Near: response: read/custom url reduce ['POST upload]

For completeness, here's the upload value:

>> print mold upload
{https://login.salesforce.com/services/Soap/u/19.0HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: ""
User-Agent: Jakarta Commons-HttpClient/3.1
Host: login.salesforce.com
Content-Length: 525


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:partner.soap.sforce.com">

   <soapenv:Header>
      <urn:CallOptions>
         <urn:client></urn:client>
         <urn:defaultNamespace></urn:defaultNamespace>
      </urn:CallOptions>
   </soapenv:Header>
   <soapenv:Body>
      <urn:login>
         <urn:username>[jort-:-researchpoint-:-com]</urn:username>

         <urn:password>metrics12378l6g7iFac5uaviDnJLFVprDl</urn:password>
      </urn:login>
   </soapenv:Body>
</soapenv:Envelope>}

Would appreciate any help you can give!
Graham
2-Jul-2010
[3846x2]
Why is there a one byte difference in the cotent-lengths?
And why is the soap body formatted that way?  Anytime I've had to 
send soap messages I had to strip out all unnecessary newlines etc 
from the soap body.
jack-ort
2-Jul-2010
[3848]
Hi Graham - sorry to be dense - how did you determine there was a 
1 byte difference in length?


Re. the soap body format, I just copied/pasted from the SoapUI screen....I 
will have to test and see if the newlines are the problem - Thanks 
for the suggestion!
Graham
2-Jul-2010
[3849x4]
sorry ... I misread it.
But ... the saleforce.com api also allows http login for testing 
thru proxies.  I suggest you test against that and use wireshark 
to trace the transaction.
Maybe the soapui screen is just reformatting for readibility and 
it's not actually what is sent.
See also the soap response you posted ... has no newlines, tabs etc
Izkata
2-Jul-2010
[3853]
I also see a 1 byte difference in length - all I did was open Rebol 
and use length? - and it returned 526.
Graham
2-Jul-2010
[3854x3]
Oh yeah .. that's what I did :)
Just forgot ...
LOL
jack-ort
2-Aug-2010
[3857]
Thought I'd see this question asked before, but couldn't find it. 
 Using makdedoc2 to create a simple table, I cannot figure out how 
to present an empty cell.  Following the table example from http://www.rebol.net/docs/makedoc/fastmd.html:

===Table

\table

Column 1

Column 2

Column 3

=row

Row 1, col 1

Row 1, col 2

Row 1, col 3

=row

Row 2, col 1

Row 2, col 2

Row 2, col 3

/table


But an extra blank row will not give you a blank cell - consequently, 
my cell values are shifting to the left to fill in the empty cells.


Is there a solution to this?  Many thanks in advance for your help!
Henrik
2-Aug-2010
[3858]
Can't test, but what happens when you use ""?
jack-ort
2-Aug-2010
[3859]
Hi Henrik!


the "" hold the place, so that my cells no longer shift over, but 
that value gets displayed in my output as a pair of double quotes, 
when I'd prefer to see a blank.  This output is headed to an Excel 
spreadsheet, for what that's worth.
Henrik
2-Aug-2010
[3860x2]
are the values really separated by commas in the syntax?
(I don't remember)
jack-ort
2-Aug-2010
[3862]
commas not part of the syntax.  In this example, they are part of 
the cell value itself.  So the first cell displays "Row 1, col1"


blank lines are what separates one cell value from the next, as far 
as I can tell.
Gregg
2-Aug-2010
[3863x2]
IIRC, I used a dash for empty cells. For export purposes, if you 
really need it blank, you may need to use a special value and then 
post-process it out. I don't know how to do a blank value right off 
either. All the normal tricks of NONE or () won't work in this context.
I'm pretty sure consecutive blank lines get folded, but can't remember.
jack-ort
2-Aug-2010
[3865x3]
everything I try seems to get taken as a literal value, so a dash 
will be a dash.

Extra blank lines do not work, if that's what you mean by folded.
would make-doc-pro handle tables better?

problem with it is, I did not see clear documentation on it.
I think the post-processing idea will work - I will try that.

Thanks to you both, Henrik and Gregg!
Gregg
2-Aug-2010
[3868]
Yes, I used a dash as a dash, knowing that meant the cell was empty. 
I think post-processing is the way to go.
Maxim
2-Aug-2010
[3869]
especially since all it needs is a replace/all  :-)
Gregg
2-Aug-2010
[3870]
Between a WRITE and a READ. :-)
Maxim
2-Aug-2010
[3871]
details  ;-)
Anton
2-Aug-2010
[3872x4]
I haven't used make-doc for a long while, but maybe you can insert 
HTML's &nbsp;
Then there's ascii char 160, which you can generate in rebol with 
to-char 160. I think they call it a 'hard space' or something.
Once you get it into your editor, you can just copy and paste it 
to all those blank cells. That should probably work.
Ah but wait, it probably depends what Excel will do with it.
Gregg
2-Aug-2010
[3876]
160 = nbsp. I don't know what Excel would do with it either.
Chris
3-Aug-2010
[3877]
You could try:

\group

/group
Yuri
14-Aug-2010
[3878x2]
Privet, ljuboj russkij programmistov zdes'?
Moj anglijskij ne ochen' horosho.
Gregg
15-Aug-2010
[3880]
I don't know if anyone speaks Russian here Yuri.
Oldes
15-Aug-2010
[3881]
Zdrastvuj Yuri:)
Pekr
15-Aug-2010
[3882]
Yuri - ja ucilsja ruskij jazyk, no ja negovorju po ruski aktivno 
:-)