472,958 Members | 2,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 9433
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

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.