Hi All ,
I am New to this Form i am working on project to consume Java Webservice from PHP (front end).i have posted the same topic in this forum yesterday but i thought the topic which is discussed here is relavent to mine. So i need to display an image sent from JWS (WSDL) mode in PHP. I have used diff methods in JWS to send the image viz as BLOB type or byte type. But unable to display it in PHP. It need to be decoded back to display which i am unable to do. Does PHP's current version has this capabilty or not??. Here is my code snippet of the soap Response genertated to be consumed in PHP. -
stdClass Object
-
(
-
[return] => stdClass Object
-
(
-
[photo] => stdClass Object
-
(
-
[bytes] => Ю 5N5MGIF89a ЯИ5Sх z jGIF89a !1џZZZcџkkksssџЅЅЅНRННЦЮЮЦЮЮЮжЅЮо{оо*чJяч яџяJяRcяBџџcџџ1џBџџЮџЮџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџ
-
)
-
-
[student_address] => 123-933-22, LA, Hyd ,India
-
[student_history] => Completed M.Tech from [student_hobbies] => Eating, Chatting ,Sleeping etc ...
-
[student_id] => 1
-
)
-
-
)
-
I am accessing this response thru this PHP code :: -
$wsdl = "http://localhost:8084/webserviceproj/WebServicesService?wsdl";
-
$client = new soapclient($wsdl,array('trace' => 1));
-
$res=$client->__soapCall('studDetails', array('parameters' => $params));
-
$variables = get_object_vars($res);
-
$keys = array_keys($variables);
-
$abc= $variables[$keys[0]]->photo;
-
$aa = $abc->bytes;
-
so i need to display image from SOAP response. see i am sending either BLOB Datatype or byte from Java. Can any one help me out. thanks
2 8574 Atli 5,058
Recognized Expert Expert
Hi.
I've moved your question into it's own thread to avoid hijacking Hejman's thread.
If you want PHP to display an image, it must be done in a separate PHP document that has it's Content-Type set to an image type.
You need to get the binary data from your SOAP response into this separate PHP document and print it there.
One way would be to temporarily store the image data on your file-system so it could be accessed by the image PHP document.
For example: -
<?php
-
# --
-
# index.php
-
# This is the PHP document that
-
# would receive the SOAP data
-
# and display it.
-
# --
-
-
# Get the SOAP stuff
-
# ... Insert code here
-
-
# Get the binary data into a temporary file
-
$tempDir = "myTemporaryFiles/";
-
$timeStamp = time() . mt_rand(100, 999);
-
$tempName = "tempImage_{$timeStamp}.tmp";
-
-
$data = $soapObj->photo->bytes;
-
-
file_put_contents($tempDir . $tempName, $data);
-
-
# Display the image
-
echo "<img src='showImage.php?ts={$timeStamp}' alt='' />";
-
?>
-
-
<?php
-
# showImage.php
-
# This is the PHP that acutally
-
# shows the image.
-
# Browsers will consider this document
-
# to be an JPEG Image, rather than HTML
-
# --
-
-
# Get the timeStamp sent via GET
-
if(!isset($_GET['ts']) or empty($_GET['ts'])) {
-
die("Timestamp is missing or invalid");
-
}
-
else {
-
$timeStamp = trim($_GET['ts']);
-
}
-
-
# Get the image data
-
$tempDir = "myTemporaryFiles/";
-
$tempName = "tempImage_{$timeStamp}.tmp";
-
$data = file_get_contents($timeDir . $tempName);
-
-
# Remove the temporary file
-
unlink($tempDir . $tempName);
-
-
# Set header and print data
-
header("Content-Type: image/jpeg");
-
echo $data;
-
?>
-
Hi,
I have tried to display it but it is not displaying image correctly . I am passing data from Java Webservice using BLOB Datatype . it is creating tmp file in the specified folder but is not converting back to image file. Can MTOM solve this problem. If there is any example using MTOM can u plz provide it thanks.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ellen K |
last post by:
Hi all,
It was my understanding (Please correct me if I'm wrong on this!) that
BLOB data actually reside on their own separate pages and a BLOB field
only holds a pointer to the location of the actual data, therefore the
BLOB data per se would not get written to the log, only the pointer
would be written.
If log shipping works by...
|
by: Paul Kennedy |
last post by:
I have a situation where I am utilizing code from MSDN to insert XLS files
into a Microsoft Access Table in a column of Ole Object using VBA and DAO.
That code also provides me with a method to extract the XLS files later.
This works wonderfully.
The Article is 103257, ACC: Reading, Storing, & Writing Binary Large Objects
(BLOBs)...
|
by: RedSouljaz |
last post by:
Hi,
How to display image that was saved in database ms sql
server 2000 into picture box. The field type that I use
in database is Images
I can save to database but cannot show from database.
Thanks
|
by: Mark |
last post by:
I have a VB 6 program that I have saved an audio file to using DAO and the
appendchunk as is shown at http://support.microsoft.com/kb/103257/EN-US/. ; I
have it working fine in that app (it saves to an access database and I can
save the data back to a file using getchunk and everything works correctly).
The issue is that I am now trying to...
|
by: den 2005 |
last post by:
Hi everyone,
Here is code working on..Trying to insert record with a column with Image
or VarBinary datatype in sql database from a existing jpeg image file, then
retrieve this image from database and display it in a Image web control
dynamically(at runtime).
The process after being displayed in the web control, user click insert/add...
| |
by: jamal8t2 |
last post by:
i have inserted blob data in database , but i am not able to access back that data to the browser. i have php script but it does not work proprly.
our script is below
if ($_REQUEST == 1) {
header("Content-type: image/jpeg");
print $bytes;
exit ();
}
|
by: Hemanth |
last post by:
Hi,
I'm trying to select the content from a BLOB field in a oracle table.
The regular select statement doesn't seem to work (Eg. select content
from file_table where file_id=1). It's returning empty content. I'm
using ADODB (http://phplens.com/adodb/) library to execute sql
statements.
Could someone please help me out on how to fetch the...
|
by: faizalahmd |
last post by:
How to display image in image control , which is retrieved from the data base . using c# in asp.net
regards,
FAIZAL AHMED.H
|
by: foss |
last post by:
HI all,
I am able to upload the image as blob to mysql. but while displaying the image i cant display it properly .
The code used for uploading image to mysql inserts data into mysql table.The uploading code is:
MYSQL_CONNECT("localhost","root","");
mysql_select_db("sample");
$data = addslashes(fread(fopen($form_data, "r"),...
|
by: vjayis |
last post by:
hi
i have stored user profile images in an BLOB field.,
and need to display it as an thumbnail image in their profile page.,
and i searched through the net and got the result using header functions as
follows.,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |