[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster-devel] question in connect to /xmlBlaster/AppletServlet in c++ client



peng at qcet.cn wrote:

>Hello:
>   I try to connect to /xmlBlaster/AppletServlet in my c++ client;
>
>my code like this:
>
>AnsiString httpstr=AnsiString("POST /xmlBlaster/AppletServlet HTTP/1.1\r\n");
>httpstr=httpstr+"cookie: \r\n";
>httpstr=httpstr+"Cache-Control: no-cache\r\n";
>httpstr=httpstr+"Pragma: no-cache\r\n";
>httpstr=httpstr+"Connection: keep-alive\r\n";
>httpstr=httpstr+"ActionType: dummyToCreateASessionId\r\n";
>httpstr=httpstr+"BinaryProtocol: true\r\n";
>httpstr=httpstr+"Data-Length: 3\r\n";
>httpstr=httpstr+"User-Agent: Java/1.5.0\r\n";
>httpstr=httpstr+"Host: 192.168.1.102:8080\r\n";
>httpstr=httpstr+"Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n";
>httpstr=httpstr+"Content-type: application/x-www-form-urlencoded\r\n";
>httpstr=httpstr+"Content-Length: 0\r\n";
>httpstr=httpstr+"\r\n";
>
>IdTCPClient1->Write(httpstr);   //IdTCPClient1 is a indy Component
>Memo1->Lines->Add(IdTCPClient1->ReadLn(EOL,2000));
>
>  get the answer from AppletServlet:
>
>HTTP/1.1 200 OK
>Server: Apache-Coyote/1.1
>Set-Cookie: JSESSIONID=D30D21BC31DE997291BEC37F654A0E77; Path=/xmlBlaster
>Content-Type: text/plain;charset=ISO-8859-1
>Transfer-Encoding: chunked
>Date: Mon, 26 Sep 2005 08:08:43 GMT
>
>46
>AAAAAAAXZHVtbXlUb0NyZWF0ZUFTZXNzaW9uSWQAAAAAABBPSy0xMTI3NzIyMTIzMDYy
>
>0
>
>what the last 4 lines mean(from "46"line to "0"line)?
>How I can decode the line "AAAAAAAXZHVtbXlUb0NyZWF0ZUFTZXNzaW9uSWQAAAAAABBPSy0xMTI3NzIyMTIzMDYy "?
>  
>
This is base64 encoded, please see
xmlBlaster/src/java/org/xmlBlaster/protocol/http/appletproxy/AppletServlet.java
about the implemented protocol.

I have commited an extended EncodableData.java which you can use (get it
from svn):

java org.xmlBlaster.util.EncodableData
AAAAAAAXZHVtbXlUb0NyZWF0ZUFTZXNzaW9uSWQAAAAAABBPSy0xMTI3NzIyMTIzMDYy

'AAAAAAAXZHVtbXlUb0NyZWF0ZUFTZXNzaW9uSWQAAAAAABBPSy0xMTI3NzIyMTIzMDYy'
-> 'dummyToCreateASessionIdOK-1127722123062'


>
>//--------------------------------------------------------------------------------------
>and then I send a "connect" command to AppletServlet:
>
>AnsiString httpstr=AnsiString("POST /xmlBlaster/AppletServlet HTTP/1.1\r\n");
>httpstr=httpstr+"cookie: "+Edit1->Text+"\r\n";
>httpstr=httpstr+"Cache-Control: no-cache\r\n";
>httpstr=httpstr+"Pragma: no-cache\r\n";
>httpstr=httpstr+"Connection: keep-alive\r\n";
>httpstr=httpstr+"ActionType: connect\r\n";
>httpstr=httpstr+"BinaryProtocol: true\r\n";
>httpstr=httpstr+"Data-Length: 9\r\n";
>httpstr=httpstr+"User-Agent: Java/1.5.0\r\n";
>httpstr=httpstr+"Host: 192.168.1.102:8080\r\n";
>httpstr=httpstr+"Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n";
>httpstr=httpstr+"Content-type: application/x-www-form-urlencoded\r\n";
>httpstr=httpstr+"Content-Length: 9\r\n";
>httpstr=httpstr+"\r\n";
>
>//    * The format:
>//    * oid + \0 + key + '\0' + qos + '\0' + content: length = oid + key + qos + content + 3
>
>httpstr=httpstr+"\0\0<qos/>\0";
>IdTCPClient1->Write(httpstr);
>
>in tomcat, I get an err :
>
>[2005-9-26 16:14:44 WARN  http-8080-Processor21 org.xmlBlaster.protocol.http.app
>letproxy.AppletServlet-127.0.0.1-7F3F49873489FC60E635B12D5991DF1F] Caught XmlBla
>ster Exception: XmlBlasterException errorCode=[user.configuration] serverSideExc
>eption=false location=[org.xmlBlaster.protocol.http.appletproxy.AppletServlet-12
>7.0.0.1-7F3F49873489FC60E635B12D5991DF1F] message=[#1.0.6 Missing connect QoS. P
>ass xmlBlaster.connectQos='<qos> ... </qos>' with your URL in your POST in a hid
>den form field or in your cookie. : ] [See URL http://www.xmlblaster.org/xmlBlas
>ter/doc/requirements/admin.errorcodes.listing.html#user.configuration]
>
>How I can encode and post the qos ?
>  
>
Additionally you could use a http sniffer (for example a plugin for
firefox) to see what exactly is transmitted.

rgds,
Marcel

>thank you!
>
>peng 
>
>
>
>
>  
>