1

I'm using MarkLogic 8 and trying to do a POST request to a server. I'm able to connect via curl or using POSTMan, however, its failing with Markloigc. A similar post suggested that its an issue with SNI as Markloigc uses OpenSSL. I have tried to put the option in the post request, however, I'm still getting the same error. Any insights to resolving this issue? See code snippet below:

xdmp:http-post($post_url,
                        <options xmlns="xdmp:http">
                         <data>{xdmp:quote($custom_json)}</data>                              
                         <headers>
                           <content-type>application/json</content-type>
                           <Host>{$host}</Host>
                         </headers>
                         <allow-sslv3>true</allow-sslv3>
                       </options>
                        )
SalH
  • 91
  • 5

2 Answers2

0

Doesn't look like you're sending any credentials. Try something like this:

xdmp:http-post(
    $post_url,
    <options xmlns="xdmp:http">
        <data>{xdmp:quote($custom_json)}</data>                              
        <headers>
            <content-type>application/json</content-type>
            <Host>{$host}</Host>
        </headers>
        <allow-sslv3>true</allow-sslv3>
        <authentication method="digest">
            <username>myUsername</username>
            <password>myPassword</password>
        </authentication>
    </options>
)
Dave Cassel
  • 8,352
  • 20
  • 38
  • The Post url contains a token which replaces the authentication. I have tried the following with OpenSSL sclient and was able to connect when I added the -servername parameter. For Example: I CANNOT connect when I try: openssl s_client -connect :443 I CAN connect when i try: openssl s_client -servername -connect :443 Question is how do I pass the -servername parameter in MarkLogic xdmp:http-post url? – SalH Mar 22 '19 at 13:16
0

Just to update this thread, I have tested the same code in MarkLogic 9 and it is working. I'm not sure if this is a combination of Marklogic 8 and the OpenSSL library its using.

SalH
  • 91
  • 5