Hi,
resending this message it came out alittle weird.
You can do the following
- ran wsd2java on your test.wsdl
- fill in the TestServiceSoapBindingImpl.java as
DateAndDecimal dad = new DateAndDecimal();
dad.setDateValue(null);
dad.setDecimalValue(new BigDecimal(5));
return dad;
- created a c# client, used code from
http://cheeso.members.winisp.net/srcview.aspx?dir=xml-serialization&file=XsiNilDate.cs
I have attached my c# client code.
-cheers
--- On Fri 07/15, < [EMAIL PROTECTED] > wrote:
From: [mailto: [EMAIL PROTECTED]
To: [email protected]
Date: Fri, 15 Jul 2005 09:08:23 -0400
Subject: Interoperability problems with Axis 1.2.1 and .NET
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6603.0">
<TITLE>Interoperability problems with Axis 1.2.1 and .NET</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">Can someone please advise whether
the below is a bug with Axis. I suspect it is as the only variable that is
changing is my version of Axis (1.1 to 1.2.1) and the binding style
(rpc/encoded to wrapped/literal).</FONT></P>
<BR>
<BR>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I am trying to convert my Axis
1.1 rpc/encoded web service to Axis 1.2.1 wrapped/literal web service but I
have come across what I think is a showstopper...</FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">If I populate all the decimal
and date fields then everything is fine. If I leave either a decimal or date
field blank then I get an exception:</FONT></SPAN><SPAN
LANG="en-gb"><B></B></SPAN><SPAN LANG="en-gb"><B> <FONT SIZE=2 FACE="Courier
New">InvalidOperationException:</FONT></B><FONT SIZE=2 FACE="Courier
New"></FONT><B> <FONT SIZE=2 FACE="Courier New">There is an error in XML
document</FONT></B></SPAN><B><SPAN LANG="en-us"></SPAN></B><SPAN
LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">. This
doesn't happen when I invoke my Axis 1.1 rpc/encoded web service from the same
version of .NET.</FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I need to use my own classes so
de/serialization uses the _Helper classes provided by Axis when using the
--helperGen option on the wsdl2Java command. </FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I have attached the wsdl and
the all the classes.</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT FACE="Arial" SIZE=2 COLOR="#000000"> <<test.wsdl>>
</FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000">
<<DateAndDecimal_Helper.java>> </FONT><FONT FACE="Arial" SIZE=2
COLOR="#000000"> <<deploy.wsdd>> </FONT><FONT FACE="Arial" SIZE=2
COLOR="#000000"> <<TestService.java>> </FONT><FONT FACE="Arial" SIZE=2
COLOR="#000000"> <<TestServiceSoapBindingImpl.java>> </FONT><FONT FACE="Arial"
SIZE=2 COLOR="#000000"> <<DateAndDecimal.java>> </FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I have also included the XML
for the response for both scenarios...</FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><U><FONT SIZE=2 FACE="Arial">When decimal element is
null</FONT></U></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">XML </FONT></SPAN>
</P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial"><?xml version="1.0"
encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="<A
HREF="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</A>"
xmlns:xsd="<A
HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:xsi="<A
HREF="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"><soapenv:Body><getDateAndDecimalResponse
xmlns="<A
HREF="http://test.axis">http://test.axis</A>"><getDateAndDecimalReturn><dateValue>2005-07-14T09:47:04.376Z</dateValue><decimalValue
xsi:nil="true"/></getDateAndDecimalReturn></getDateAndDecimalResponse></soapenv:Body></soapenv:Envelope>
</FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">.NET error message</FONT></SPAN>
</P>
<P><SPAN LANG="en-gb"><FONT SIZE=2 FACE="Courier
New">[FormatException:</FONT></SPAN><SPAN LANG="en-gb"><B> <FONT SIZE=2
FACE="Courier New">Input string was not in a correct format</FONT></B><FONT
SIZE=2 FACE="Courier New">.] System.Number.ParseDecimal(String s,
NumberStyles style, NumberFormatInfo info) +0 System.Decimal.Parse(String s,
NumberStyles style, IFormatProvider provider) +30
System.Xml.XmlConvert.ToDecimal(String s) +100
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_DateAndDecimal(Boolean
isNullable, Boolean checkType) +438
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read13_getDateAndDecimalResponse()
+307 [</FONT><B><FONT SIZE=2 FACE="Courier
New">InvalidOperationException:</FONT></B><FONT SIZE=2 FACE="Courier
New"></FONT><B> <FONT SIZE=2 FACE="Courier New">There is an error in XML
document</FONT></B> <FONT SIZE=2 FACE="Courier New">(1, 384).]
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle, XmlDeserializationEvents events) +413
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader,
XmlDeserializationEvents events) +25
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader) +24
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
+1057 System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters) +218
Wrapped.AxisTests.TestServiceService.getDateAndDecimal(Int32 in0) in
c:\webroot\wrapped\web references\axistests\reference.cs:61
Wrapped.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\webroot\wrapped\webform1.aspx.cs:97
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,
String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292 <BR>
</FONT></SPAN><SPAN LANG="en-gb"><U></U><U></U><U><FONT FACE="Times New
Roman">When date element is null</FONT></U></SPAN>
<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman">XML </FONT></SPAN>
<BR><SPAN LANG="en-gb"><FONT FACE="Times New Roman"><?xml version="1.0"
encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="<A
HREF="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</A>"
xmlns:xsd="<A
HREF="http://www.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</A>"
xmlns:xsi="<A
HREF="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"><soapenv:Body><getDateAndDecimalResponse
xmlns="<A
HREF="http://test.axis">http://test.axis</A>"><getDateAndDecimalReturn><dateValue
xsi:nil="true"/><decimalValue>4.000</decimalValue></getDateAndDecimalReturn></getDateAndDecimalResponse></soapenv:Body></soapenv:Envelope></FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">.NET error
message</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN LANG="en-gb"></SPAN><SPAN
LANG="en-gb"></SPAN>
<BR><SPAN LANG="en-gb"><FONT FACE="Times New
Roman">[FormatException:</FONT></SPAN><SPAN LANG="en-gb"><B> <FONT FACE="Times
New Roman">String was not recognized as a valid DateTime</FONT></B><FONT
FACE="Times New Roman">.] System.DateTimeParse.ParseExactMultiple(String s,
String[] formats, DateTimeFormatInfo dtfi, DateTimeStyles style, DateTime&
result) +286 System.DateTime.ParseExact(String s, String[] formats,
IFormatProvider provider, DateTimeStyles style) +39
System.Xml.XmlConvert.ToDateTime(String s, String[] formats) +103
System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String value, String[]
formats) +9 System.Xml.Serialization.XmlCustomFormatter.ToDateTime(String
value) +30 System.Xml.Serialization.XmlSerializationReader.ToDateTime(String
value) +5
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read6_DateAndDecimal(Boolean
isNullable, Boolean checkType) +358
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read13_getDateAndDecimalResponse()
+307 [</FONT><B><FONT FACE="Times New Roman">InvalidOperationException: There
is an error in XML document</FONT></B> <FONT FACE="Times New Roman">(1, 333).]
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle, XmlDeserializationEvents events) +413
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader,
XmlDeserializationEvents events) +25
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader) +24
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall) +1057
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName,
Object[] parameters) +218
Wrapped.AxisTests.TestServiceService.getDateAndDecimal(Int32 in0) in
c:\webroot\wrapped\web references\axistests\reference.cs:61
Wrapped.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\webroot\wrapped\webform1.aspx.cs:97
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292 </FONT></SPAN></P>
<P><SPAN LANG="en-gb"><U><FONT FACE="Times New Roman">Environment</FONT></U><BR>
</SPAN><SPAN LANG="en-us"></SPAN><SPAN LANG="en-us"><FONT SIZE=2
FACE="Arial">Axis 1.2.1 wrapped/literal service deployed to websphere
server</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">WebSphere Platform 5.1 [BASE
5.1.1 a0426.01] [JDK 1.4.2 cn1420-20040626] [PME 5.1.1 o0429.02] running with
process name localhost\localhost\server1 and process id 3052</FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Host Operating System is
Windows 2000, version 5.0</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Java version = J2RE 1.4.2 IBM
Windows 32 build cn1420-20040626 (JIT enabled: jitc), Java Compiler = jitc,
Java VM name = Classic VM</FONT></SPAN></P>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Microsoft Development
Environment 2003</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Microsoft .NET Framework
1.1</FONT></SPAN>
<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Microsoft Visual C# .NET
69586-335-0000007-18998</FONT></SPAN><SPAN LANG="en-gb"></SPAN><SPAN
LANG="en-gb"></SPAN><SPAN LANG="en-gb"> </SPAN>
</P>
<BR>
<pre>__________________________________________________________________________________________________________________________________
This e-mail may be privileged and/or confidential, and the sender does not
waive any related rights and obligations.
Any distribution, use or copying of this e-mail or the information it contains
by other than an intended recipient is unauthorized.
If you received this e-mail in error, please advise me (by return e-mail or
otherwise) immediately.
Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce
pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il
contient par une personne autre que le (les) destinataire(s) désigné(s) est
interdite.
Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser
immédiatement, par retour de courrier électronique ou par un autre
moyen.</pre></BODY>
</HTML><p>Attachment: test.wsdl (3.62KB)<br>Attachment:
DateAndDecimal_Helper.java (3.07KB)<br>Attachment: deploy.wsdd
(2.86KB)<br>Attachment: TestService.java (0.45KB)<br>Attachment:
TestServiceSoapBindingImpl.java (0.54KB)<br>Attachment: DateAndDecimal.java
(1.36KB)<br>
_______________________________________________
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.2032
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version
1.1.4322.2032.
//
namespace ConsoleApplication1.localhost1 {
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="TestServiceSoapBinding",
Namespace="http://test.axis")]
public class TestServiceService :
System.Web.Services.Protocols.SoapHttpClientProtocol {
/// <remarks/>
public TestServiceService() {
this.Url = "http://localhost:8080/axis/services/TestService";
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
RequestNamespace="http://test.axis", ResponseNamespace="http://test.axis",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return:
System.Xml.Serialization.XmlElementAttribute("getDateAndDecimalReturn")]
public DateAndDecimal getDateAndDecimal(int in0) {
object[] results = this.Invoke("getDateAndDecimal", new object[] {
in0});
return ((DateAndDecimal)(results[0]));
}
/// <remarks/>
public System.IAsyncResult BegingetDateAndDecimal(int in0,
System.AsyncCallback callback, object asyncState) {
return this.BeginInvoke("getDateAndDecimal", new object[] {
in0}, callback, asyncState);
}
/// <remarks/>
public DateAndDecimal EndgetDateAndDecimal(System.IAsyncResult
asyncResult) {
object[] results = this.EndInvoke(asyncResult);
return ((DateAndDecimal)(results[0]));
}
}
/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://test.axis")]
public class DateAndDecimal {
/// <remarks/>
//public System.DateTime dateValue;
private static string formatString=
"yyyy-MM-ddTHH:mm:ss.fffffffzzz";
private static System.Globalization.CultureInfo CInfo= new
System.Globalization.CultureInfo("en-US", true);
[XmlIgnore] public System.DateTime internal_DateTimeField;
[XmlIgnore] public bool DateTimeFieldIsNull;
[XmlElement(IsNullable=true)]
public string dateValue
{
set
{
if ((value!=null) && (value != ""))
{
internal_DateTimeField=
System.DateTime.ParseExact(value, formatString, CInfo);
DateTimeFieldIsNull= false;
}
else DateTimeFieldIsNull= true;
} get
{
return (DateTimeFieldIsNull) ? null :
internal_DateTimeField.ToString(formatString) ;
}
}
/// <remarks/>
public System.Decimal decimalValue;
}
}