Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7753937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:10:49+00:00 2026-06-01T12:10:49+00:00

I am working on making a web service using soap. I’m stuck at trying

  • 0

I am working on making a web service using soap. I’m stuck at trying to figure out to convert a hash into a JSON using perl. Now I am testing it with the client side and I am trying to print out the JSON- so I’m not sure if my problem lies on the server side or the client side.

Here is my server side code.

 #create hash
 my %hash_to_encode = (
    weigh => $weight,
    price => $price,
    unit  => $unit,
    picture=> $picture,
    amount => $amount,
    dimensions => $dimensions,
    country => $country,
    description => $description,
    name => $name,
    category => $category,
    comment => $comment,
    expires => $expires
  );

 my $json_string = JSON->new->utf8->encode(%hash_to_encode);

return $json_string;

My client side code:
#! /usr/bin/perl -w
use CGI qw(:standard);
use SOAP::Lite;
use JSON;
print "Content-type: text/html\n\n";

my $exhibitID = '13';
my $username = 'us43';
my $password = 'green4356';
my $link = 'its a secret :P';
my $namespace = 'also a sewcret';
#The soap call works (i have other functions and they work as expected so dont worry about this part.
my $mySoap = SOAP::Lite
 -> uri($link)
 -> proxy($namespace);

#This is where the error lies.
my $result = $mySoap->status($exhibitID, $username, $password)->result;
print "Json String: $result";

#my $jsonString= JSON->new->utf8->decode($result);
#print "Status is: $jsonString";

print "<p> Finished status</p>";

Thanks for the help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T12:10:51+00:00Added an answer on June 1, 2026 at 12:10 pm
    my $json_string = JSON->new->utf8->encode(\%hash_to_encode);
    

    You need to provide a hash-reference, not just a hash to the encode function.

    To do so either add the backslash as I have done above or change the definition as below (Only do one of the two though…)

    my $hash_to_encode = {
    weigh => $weight,
    price => $price,
    unit  => $unit,
    picture=> $picture,
    amount => $amount,
    dimensions => $dimensions,
    country => $country,
    description => $description,
    name => $name,
    category => $category,
    comment => $comment,
    expires => $expires
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a simple web server using PHP and sockets. Everything is working fine
I'm working on a web service and I need a code for making an
i've been making web app's and working with various server side language like php,
We're making this web app in PHP and when working in the reports we
I'm working on making some code using metaheuristics for finding good solutions to the
I am using ASIHTTPRequest to fetch some data from a web service. I am
For this question, I'm using ASP.NET Web Forms in C#, a web service and
I have a working PHP web service that returns data (if I input the
I am currently working on a silverlight client, making use of a web server,
I'm working on a web application written in Java using the Tapestry 5.1.0.5 framework.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.