473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Php Client / .Net Webservice / Datetime problem - Urgent!

Problem in sending datatime format to the .net webservice from php.
description follows.
I've created a .net webservice.

..Net Webservice:

<WebMethod()> _
Public Function HelloDate(ByVal mydate As DateTime) As String
mystr = mydate.ToString("dddd") 'Which displays day
Return mystr
End Function

Php Client:

$parameters['mydate'] = "12 June 2005;
$soap_proxy = $s->getProxy();
$result = $soap_proxy->HelloDate($parameters);
if (!$err = $soap_proxy->getError()){
echo($result["HelloDateResult"]);
}else{
echo 'Error: ' . $err . "\n";
}

When i tried to communicate the .net webservice. It shows following
error.

"Error: soap:Client: Server was unable to read request. --> There is an
error in XML document (1, 460). --> String was not recognized as a
valid DateTime. "

How to send datetime format data to the webservice from php. For
String, Numbers above code works well.

Jul 17 '05 #1
4 9461
On 3 Jun 2005 10:16:12 -0700, ra*******@gmail.com wrote:
Problem in sending datatime format to the .net webservice from php.
description follows.

I've created a .net webservice.

.Net Webservice:

<WebMethod()> _
Public Function HelloDate(ByVal mydate As DateTime) As String
mystr = mydate.ToString("dddd") 'Which displays day
Return mystr
End Function

Php Client:

$parameters['mydate'] = "12 June 2005;
$soap_proxy = $s->getProxy();
$result = $soap_proxy->HelloDate($parameters);
if (!$err = $soap_proxy->getError()){
echo($result["HelloDateResult"]);
}else{
echo 'Error: ' . $err . "\n";
}

When i tried to communicate the .net webservice. It shows following
error.

"Error: soap:Client: Server was unable to read request. --> There is an
error in XML document (1, 460). --> String was not recognized as a
valid DateTime. "

How to send datetime format data to the webservice from php. For
String, Numbers above code works well.


Having never used webservices this may be the wrong track, but I'd look at:

http://www.w3.org/TR/xmlschema-2/#dateTime

"12 June 2005" doesn't look like the sort of thing a portable format would
accept. 2005-06-12T00:00:00 looks more like it.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
NC
ra*******@gmail.com wrote:

I've created a .net webservice.

.Net Webservice:

<WebMethod()> _
Public Function HelloDate(ByVal mydate As DateTime) As String
mystr = mydate.ToString("dddd") 'Which displays day
Return mystr
End Function
Bad idea. Web services exchange data in text format and should
be platform-independent. Consequently, the only argument type
(and the only return type) allowed for a Web service method
should be String.

Rewrite your method:

<WebMethod()> _
Public Function HelloDate(ByVal myinput As String) As String
if IsDate(myinput) Then
mydate = CDate(myinput)
mystr = mydate.ToString("dddd")
Return mystr
Else
' handle the error; the supplied argument
' cannot be converted to date
End If
End Function
How to send datetime format data to the webservice from php.


DateTime is a .NET-specific structure. You should avoid having
to send to (or receive from) a Web service anything that is not
string.

Cheers,
NC

Jul 17 '05 #3
On 3 Jun 2005 10:16:12 -0700, ra*******@gmail.com wrote:
$parameters['mydate'] = "12 June 2005;
$result = $soap_proxy->HelloDate($parameters);


In addition to the remarks made by Andy and NC, try passing the actual
string, not an array.

$result = $soap_proxy->HelloDate($parameters['mydate']);
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #4
Thanks Andy,

It wroks well. thanks a lot..

$parameters['mydate'] = "2005-06-04T00:00:00";
$soap_proxy = $s->getProxy();
$result = $soap_proxy->HelloDate($parameters);
if (!$err = $soap_proxy->getError()){
echo($result["HelloDateResult"]);
}
else{
echo 'Error: ' . $err . "\n";
}
Thanks for your effort.

Thanks NC, Ewoud Dronkert.

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Paul ngpc | last post by:
Hi folks This is a challenging and interesting topic. Need HELP on this, would be good if some tips/techniques can be given for the topic. Using VB.NET client to connect to JavaWebserver....
1
by: Paul NGPC | last post by:
Hi folks This is a challenging and interesting topic. Need HELP on this, would be good if some tips/techniques can be given for the topic. Using VB.NET client to connect to JavaWebserver....
0
by: paulngpc | last post by:
> Hi folks > > This is a challenging and interesting topic. Need HELP on > this, would be good if some tips/techniques can be given > for the topic. > > Using VB.NET client to connect to...
6
by: Stewart Saathoff | last post by:
Hello, I would like to programatically redirect the location of a web service from the client machine. Let me explain further. This is the exact process: I would like the client to click a...
0
by: Papp György | last post by:
Hi I have created a webservice with c# inVisual Studio 2003 by the ASP Web Service template. Then I created a client application to test the web service and the following error occurs : An...
1
by: Hemant Pathak | last post by:
Hi All i have develop a software(Customer Service Managment System) front end is VB 6.0 and Back end is SQL 2000 i want to run this software is Server System and Client System the how can i do this....
6
by: Simon Harvey | last post by:
Hi everyone, We have a need to make a Windows Forms (2.0) client application that will be installed on our clients site. The data that the application uses needs to be centrally available to a...
0
by: kingking | last post by:
Hi All, I have a java webservice . I want to communicate to it through Dot Net client. Webservice contains 6 methods and I want to use 5 methods. Based on the provided WSDL, I have created web...
4
by: reach2raziq | last post by:
Hi All, I have one web site and server that is hosted on "Pacific Standard Time" Zone . When a user from different contries creat blogs the displayed time for respective blog will be a server...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
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 project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.