Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Calling a web service link through linux script


    Problem Description: Our project have web service created which we use to create data files from database. To create these files we have to open a particular link which automatically start creating files and MQ them as soon as we hit it in web browser.

    Link looks like as below
    xxxx.xx.:8000/$filter=Country eq 'US' & language='EN-US' & $format=MQ

    There is a user id and password too,which appear as a prompt after putting the link in web browser and hitting enter.

    We have to create a script to execute this link everyday through linux. We have tried "curl" command to achieve the result but couldn't get success.We are following issue

    1) In link "space" "$" and "&" characters have been used, which are pre-defined symbol for linux. So when it pass through curl command so it takes them as standard {for example it takes $format as variable)

    2) when we are somehow able to manage to pass correct link,its give below error

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="//">
    <faultstring>Policy Falsified</faultstring>
    <faultactor>$filter=Country eq 'US' & language='EN-US' & $format=MQ</faultactor>
    <l7olicyResult status="Assertion Falsified" xmlns:l7=""/>

    Could anyone provide the suggestions to solve the issue ?

  2. #2
    Hello and welcome,

    try escaping the "$" character with a \ and the ampersand and other special chars using URL encoded equivalents.
    Last edited by atreyu; 10-20-2012 at 03:05 PM. Reason: Welcome, first time poster!

  3. #3
    Thanks for your Inputs !!

    We tried with "\" with "$" but it goes in browser with "\" too which creates and invalid link. Also on receiving side there is no decoding hence replacing the characters won't work either.

  4. $spacer_open
  5. #4
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    The Netherlands
    Single quotes prevent the shell from expanding/interpreting special characters, maybe you could try this?
    curl 'xxxx.xx.:8000/$filter=Country eq "US" & language="EN-US" & $format=MQ'
    You'd need to replace the existing single quotes in the string to double quotes, or all sorts of things will go wrong... hope this hasn't any side effects.
    Can't tell an OS by it's GUI

  6. #5
    Quote Originally Posted by raviagrwal View Post
    xxxx.xx.:8000/$filter=Country eq 'US' & language='EN-US' & $format=MQ
    okay, your URL is a bit confusing. this is what i think are the CGI parameters:

    CGI param        CGI value
    ----------       ---------
    filter           Country eq 'US'
    language         'EN-US'
    format           MQ
    1. first of all, are the above assumptions correct?

    2. what is with the spaces inb/t parameter names (before and after the '&' character)? does the web server really expect that? e.g., the CGI perl module I use does not like that.

    3. can "Country" not be its own CGI parameter?

    4. does "language" really need the enclosing single quotes?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts