I made some progress but still need help. The reason I set the Content-Type in my request header to "text/xml" is from reading this: http://ws.apache.org/axis2/0_94/rest-ws.html according to which "text/xml" is required for a message to be treated as RESTful. The doc is for java, I assumed the same for axis2c.
But I find that when Content-Type is changed to "application/x-www-form-urlencoded", the problem of a null top-level axiom_node_t goes away and a test POST message is received and processed successfully by my service. However, "application/x-www-form-urlencoded" is not really what I want. When I try "image/jpeg" or "application/octet-stream", the server reports that those types are not supported. So now my question is, if I want to upload an image by POST how should I set the Content-Type of the http request? Would appreciate advice- -----Original Message----- From: Arnie Chien [mailto:[EMAIL PROTECTED] Sent: Monday, September 08, 2008 5:21 PM To: 'Apache AXIS C User List' Subject: RE: problem with upload to REST-enabled service I see the following with tcpmon: C:\axis2c\bin\tools>tcpmon Listen port : 9090 Target port : 8080 Target host: localhost SENDING DATA.. /* sending time = 12:59:17*/ /* message uuid = bcfa81c7-213a-4e8e-b60f-5405ba9dd283*/ --------------------- POST /axis2/services/KIPSvc/getVC HTTP/1.1 TE: deflate,gzip;q=0.3 Connection: TE, close Host: 192.168.2.16:9090 User-Agent: libwww-perl/5.806 Content-Length: 43 Content-Type: text/xml upfile=c%3A%2Ftestdb%2F478359.jpg ERROR: error in creating the host socket This is a POST; tcpmon reports the same error when I do a GET. But, for a POST I have the problem I described originally (i.e. the axiom_node_t argument of the getVC operation is null), even when I don't actually try to upload anything. Whereas for a GET I do not have that problem, and everything works fine. I haven't been able to find help in the archives or documentation, would appreciate any suggestions. -----Original Message----- From: Samisa Abeysinghe [mailto:[EMAIL PROTECTED] Sent: Sunday, September 07, 2008 10:48 AM To: Apache AXIS C User List Subject: Re: problem with upload to REST-enabled service Arnie Chien wrote: > Ok thanks. In the meantime, can you tell me whether I'm right that it > should be possible for this to work when the client is not written to the > axis2 api, and just sends standard http requests? > Correct. Samisa... > -----Original Message----- > From: Samisa Abeysinghe [mailto:[EMAIL PROTECTED] > Sent: Friday, September 05, 2008 11:23 AM > To: Apache AXIS C User List > Subject: Re: problem with upload to REST-enabled service > > Arnie Chien wrote: > >> Do you mean verify what the message is as it leaves the client? I don't >> know how to capture it on the server if the service operation is not >> receiving anything. >> > > Try using TCPMon. > > Samisa... > > >> I'm new to axis so would appreciate if you could advise >> me. In case it helps, the log reads: >> >> [Thu Sep 04 18:06:08 2008] [debug] >> ..\..\src\core\transport\http\common\http_worker.c(192) Client HTTP >> > version > >> HTTP/1.1 >> [Thu Sep 04 18:06:08 2008] [debug] >> ..\..\src\core\transport\http\util\http_transport_utils.c(289) HTTP stream >> chunked >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\rest_disp.c(113) >> Checking for service using target endpoint address : >> http://12.11.162.2:9090/axis2/services/KIPSvc/getVC >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\rest_disp.c(134) >> Service found using target endpoint address >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\rest_disp.c(201) >> Checking for operation using REST HTTP Location fragment : /getVC >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\rest_disp.c(209) >> Operation found using target endpoint uri fragment >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler request_uri_based_dispatcher within the phase Transport >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler AddressingInHandler within the phase Transport >> [Thu Sep 04 18:06:09 2008] [info] Starting addressing in handler >> [Thu Sep 04 18:06:09 2008] [info] >> ..\..\src\modules\mod_addr\addr_in_handler.c >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler addressing_based_dispatcher within the phase Transport >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler rest_dispatcher within the phase Dispatch >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler soap_message_body_based_dispatcher within the phase Dispatch >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler soap_action_based_dispatcher within the phase Dispatch >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler dispatch_post_conditions_evaluator within the phase >> > PostDispatch > >> [Thu Sep 04 18:06:09 2008] [debug] ..\..\src\core\engine\phase.c(210) >> > Invoke > >> the handler context_handler within the phase PostDispatch >> [Thu Sep 04 18:06:09 2008] [warning] ..\..\src\core\description\op.c(1149) >> Message id not found for message context while registering operation >> > context > >> for operation getVC >> [Thu Sep 04 18:06:10 2008] [info] Request served successfully >> >> >> -----Original Message----- >> From: Manjula Peiris [mailto:[EMAIL PROTECTED] >> Sent: Thursday, September 04, 2008 11:28 PM >> To: Apache AXIS C User List >> Subject: Re: problem with upload to REST-enabled service >> >> Can you capture the message which is sent to the server ? >> >> On Thu, 2008-09-04 at 17:19 -0400, Arnie Chien wrote: >> >> >>> Hi, >>> I'm trying to upload an image to an axis2c server. The image is handled >>> >>> >> by >> >> >>> a service which is REST-enabled (modeled after the echo sample). The >>> services.xml is >>> >>> <service name="KIPSvc"> >>> <parameter name="ServiceClass" locked="xsd:false">KIPSvc</parameter> >>> <description/> >>> <operation name="getVC"> >>> <parameter name="RESTMethod">POST</parameter> >>> <parameter name="RESTLocation">getVC</parameter> >>> </operation> >>> </service> >>> >>> The client is written in Java, but does not use the axis2 API; it just >>> constructs a POST request using the java HttpConnection class. (My >>> understanding of REST is that this should be okay.) It sets content-type >>> >>> >> to >> >> >>> text/xml, and sends the image data as a sequence of bytes. >>> >>> Processing gets into the service dll, such that the getVC operation >>> >>> axiom_node_t * >>> axis2_KIPSvc_getVC( >>> const axutil_env_t * env, >>> axiom_node_t * node) >>> >>> is called. But the "node" argument is null. Could someone could tell me >>> what the problem might be? Many thanks in advance- >>> >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> ------------------------------------------------------------------------ >> >> >> No virus found in this incoming message. >> Checked by AVG - http://www.avg.com >> Version: 8.0.169 / Virus Database: 270.6.16/1653 - Release Date: 9/5/2008 >> > 6:57 AM > >> >> > > > > ------------------------------------------------------------------------ > > > No virus found in this incoming message. > Checked by AVG - http://www.avg.com > Version: 8.0.169 / Virus Database: 270.6.16/1653 - Release Date: 9/5/2008 6:57 AM > > -- Samisa Abeysinghe Director, Engineering; WSO2 Inc. http://www.wso2.com/ - "The Open Source SOA Company" --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
