473,804 Members | 3,424 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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($par ameters);
if (!$err = $soap_proxy->getError()){
echo($result["HelloDateResul t"]);
}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 9497
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($par ameters);
if (!$err = $soap_proxy->getError()){
echo($result["HelloDateResul t"]);
}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.andyhsoftwa re.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($par ameters);


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

$result = $soap_proxy->HelloDate($par ameters['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($par ameters);
if (!$err = $soap_proxy->getError()){
echo($result["HelloDateResul t"]);
}
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
1233
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. Don't know how to use the 2-way SSL to communicate and make the SSL handshake process( at Transport level https://///) transparent. Any .NET classes to make all the 2-way SSL
1
3290
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. Don't know how to use the 2-way SSL to communicate and make the SSL handshake process( at Transport level https://) transparent. Any .NET classes to make all the 2-way SSL
0
4548
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 JavaWebserver. Don't > know how to use the 2-way SSL to communicate and make the > SSL handshake process( at Transport level https://) > transparent. Any .NET classes to make all the 2-way SSL
6
6060
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 menu bar like Tools -> Server Address and be able to type the location of the webservice. I would then save this data to the registry and when the client works in the application, they would be making calls to the specified web service.
0
993
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 unhandled exception of type 'System.Web.Services.Protocols.SoapException' occurred in system.web.services.dll
1
1237
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. please urgent...........
6
2010
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 potentially large number of other sites, which would seem to leave us with our traditional approach, or having a central database server on a dedicated server someplace.
0
1139
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 reference in VS and could able to access 3 methods. These methods are : getReservationStatus,getReservations,cancelReservation). And the methods with which I am facing problem are : createReservation,modifyReservation). I am getting Deserialization...
4
7892
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 time.. the code below is what i am using for conversion.. TimeZoneInfo PTZone = TimeZoneInfo.FindSystemTimeZoneById( "Pacific Standard Time" ); lbl_createonvalue.Text = TimeZoneInfo.ConvertTime( DateTime.Parse( incident.CreatedOn.ToString() ),...
0
9710
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9589
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10593
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10329
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9163
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6858
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.