473,385 Members | 1,615 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,385 software developers and data experts.

SOAP C# - Optional Properties

How can you not require parameters in the WSDL of type DateTime, int,
double?

For example:

A DateTime field in a C# web service always serializes as:

<s:element minOccurs="1" maxOccurs="1" name="MyDateField"
type="s:dateTime" />

How does it have to be declared (or manipulated) in the C# code to end
up in the WSDL as:

<s:element minOccurs="0" maxOccurs="1" name="MyDateField"
type="s:dateTime" />

Apr 4 '06 #1
3 8488
Hi Ian,

have you tried to use this?

....
public DateTime MyDateField;

[XmlIgnore]
public bool MyDateFieldSpecified;
....

George
Apr 4 '06 #2
George,
Your solution creates a property for my class that is not visible to
the web service. It does not change the minOccurs setting of the
MyDateField. I'm trying to set minOccurs="0" for MyDateField.

Apr 4 '06 #3
Try attributing with DefaultValue[Attribute] (in System.ComponentModel)

public class TestClass {
[DefaultValue(0)]
public int TestField;
private int _testPropField;
[DefaultValue(0)]
public int TestProperty {
get { return _testPropField; }
set { _testPropField = value; }
}
}

this gives:

<s:element minOccurs="0" maxOccurs="1" default="0" name="TestField"
type="s:int" />
<s:element minOccurs="0" maxOccurs="1" default="0" name="TestProperty"
type="s:int" />

Very close...

Marc

"Ian Jenkins, MCSD" <jw*******@gmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
George,
Your solution creates a property for my class that is not visible to
the web service. It does not change the minOccurs setting of the
MyDateField. I'm trying to set minOccurs="0" for MyDateField.


Apr 11 '06 #4

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

Similar topics

0
by: Arne Kösling | last post by:
Hi ! I am new to Web Services. Therefore I ve set up a PHP Installation on Windows (PHP 4.3.2 and Apache 1.3.29). I have tested PHP alone and then installed PEAR. Now I am stuck there (Before...
3
by: junkmail | last post by:
on a win 2k server apparantly it is saying i dont have it. or it cant find it. im using mySQL 4.1 php 4.3.x apache 3.0.53 im new to php and am doing some tutorials, but when i run the sripts...
0
by: Hans Kesting | last post by:
Hi, I'm trying to create a client for some webservice. BUT I have only limited information: * no WSDL available ("expected Q1-06") (it seems to be written in Java) * I don't have access (yet)...
0
by: Paul C | last post by:
Hi, I have an interesting problem with my RPC encoded webservices. When I upgrade to Framework 1.1, I get the following error when calling my web methods. After a bit (make that quite a...
7
by: Biao | last post by:
I have a web service writen by .NET: public string Greetings(string names) { string gs = new string; for (int i = 0; i < gs.Length; i++) gs = string.Format("Hello, {0}", names);
8
by: Dave A | last post by:
I have a class called 'PrimaryKey' that represents the primary key of a table. PrimaryKeys can only be created and the class only implements .ToString(). The PrimaryKey class internally stores...
4
by: Ramon de Klein | last post by:
I have created a SOAP extension that can be enabled using a SoapExtensionAttribute. This attibute holds two additional properties that are used to configure the SOAP extension. This works fine, but...
14
by: cody | last post by:
I got a similar idea a couple of months ago, but now this one will require no change to the clr, is relatively easy to implement and would be a great addition to C# 3.0 :) so here we go.. To...
3
by: mirandacascade | last post by:
1) Is it correct that none of the examples in the ElementSOAP tutorial: http://effbot.org/zone/elementsoap-1.htm include an example in which the SOAP message that contains the request includes...
0
by: Jim Garrison | last post by:
I'm trying to process output from a Web Service using XSL. The output XML seems to randomly render some tags as hrefs to other tags, making the job of parsing the result with XSL really difficult....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
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...

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.