Skip to content

Errors using <http:body> in EXPath HTTP Client 0.12.0 #4

@StephanLehmke

Description

@StephanLehmke

The following example doesn't work in combination with Saxon and expath-http-client-saxon-0.12.0:

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:http="http://expath.org/ns/http-client"
                xmlns:h="http://www.w3.org/1999/xhtml"
                exclude-result-prefixes="#all"
                version="2.0">

   <xsl:import href="http://expath.org/ns/http-client.xsl"/>

   <xsl:output indent="yes"/>

   <xsl:template name="main" match="/">
      <root>
         <!-- the request element -->
         <xsl:variable name="request" as="element(http:request)">
           <http:request method="post" href="http://127.0.0.1:8888/test">
         <http:body media-type="text/plain">foo</http:body>
       </http:request>
         </xsl:variable>
         <!-- sending the request -->
         <xsl:variable name="resp" select="http:send-request($request)"/>
         <!-- add the http:response element to the output tree -->
         <xsl:sequence select="$resp[1]"/>
      </root>
   </xsl:template>

</xsl:stylesheet>

When I run the script with

saxon -xsl:post-example.xsl -it:main
then I get the following error messages

INFO: Create a new repository with storage: File system storage in /usr/share/expath/repo
No license file found - running with licensable features disabled
2016/05/15 13:08:04:193 CEST [INFO] DefaultHttpClient - I/O exception (java.io.IOException) caught when processing request to {}->http://127.0.0.1:8888: Error serializing the body content
2016/05/15 13:08:04:195 CEST [INFO] DefaultHttpClient - Retrying request to {}->http://127.0.0.1:8888
2016/05/15 13:08:04:196 CEST [INFO] DefaultHttpClient - I/O exception (java.io.IOException) caught when processing request to {}->http://127.0.0.1:8888: Error serializing the body content
2016/05/15 13:08:04:196 CEST [INFO] DefaultHttpClient - Retrying request to {}->http://127.0.0.1:8888
2016/05/15 13:08:04:196 CEST [INFO] DefaultHttpClient - I/O exception (java.io.IOException) caught when processing request to {}->http://127.0.0.1:8888: Error serializing the body content
2016/05/15 13:08:04:196 CEST [INFO] DefaultHttpClient - Retrying request to {}->http://127.0.0.1:8888
Error on line 18 of post-example.xsl:
  Error sending the HTTP request
Error sending the HTTP request

and an invalid request is sent. The port is because I was checking the sent request with Fiddler.

With version 0.11.0 it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions