|
Hello, I am a new member of the code project and i have found this site to be a very interesting and helpful place. This is my first blog but this site have already helped me through so much. However i came accross one very confusing problem in .net. I am working with web services and i am creating a client for a service that someone else already have in place. I generated a proxy class from wsdl, with some complex type that if null will be notified by <var nil:true> no matter what the variable type is.
Now the problem is when i send in a request value that does not exists in their database, its normal for them to return null, but my application, the client application throw a nullreference exception. Saying that the input format is incorrect. I am a newbie with web service and i have been trying to trace the problem, when the search value exists this does not happen. Here is the stack trace and a sample soap message. Hope someone can help me out.. THankz.
<CP0307I01Response xmlns="namespace">
<EAIHeader>
<serviceId>ID</serviceId>
<beginTimestamp>2006-06-26T15:40:26.125+07:00</beginTimestamp>
<endTimestamp>2006-06-26T15:35:11.955+07:00</endTimestamp>
<transactionId>0f7a58bf0ac6321501fd4878a404f1f5</transactionId>
<sourceTransactionId>3000</sourceTransactionId>
<sourceSystem>RSB</sourceSystem>
<userId>user</userId>
<password>password</password>
<status>3</status>
<reasonCode>60007</reasonCode>
<reasonDesc>CPACholder not found</reasonDesc>
</EAIHeader>
<CPACholder>
<cardExpDate xsi:nil="true"></cardExpDate>
<cardholderID xsi:nil="true"></cardholderID>
<creditLimit xsi:nil="true"></creditLimit>
<currentAcctNo xsi:nil="true"></currentAcctNo>
<fstEbName xsi:nil="true"></fstEbName>
<ownCustObj xsi:nil="true"></ownCustObj>
<savingAcctNo xsi:nil="true"></savingAcctNo>
</CPACholder>
</CP0307I01Response>
Stack trace : err msg = "There is an error in xml document (4,677)"
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at CP0307I01.doService(EAIHeader& EAIHeader, CPACCardholder& CPACCardholder) in D:\e-MobileApplicationProjects\asynWebTest\asynWebTest\CP0307I01ProxyClass.cs:line 42
at asynWebTest.Program.Main(String[] args) in D:\e-MobileApplicationProjects\asynWebTest\asynWebTest\Program.cs:line 22
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
Thznk in advance i have been trying to figure it out for many days hopefully someone with enough experience will know
Wicky
|
|
|
|
|
Hi,
When i tried to "Add New Item" (Crystal Report), there is no Template for Crystal Report in the Template area. Is there any way to add it exclusively, or need to change some sort of settings?
Or it is the matter of installation. I first installed the .Net VS 2005 Express edition (C#) a month ago, and installed recently, Crystal report 10. I'm using SQL Server 2000 at back.
I just want to include reports in my windows application, and for this tried various methods (including report binding options from MSDN too), but no use.
Can anybody help in this regard. Any idea, suggestion, guideline please.
Thanks
_____________________________
Success is not something to wait for, its something to work for.
-- modified at 7:29 Monday 26th June, 2006
|
|
|
|
|
Hi,
I've implemented a class (see below) to handle communications for multiple objects that use a separate thread to handle UDP communications over the same ports using the UdpClient class (.net 2.0). To be sure only one instance can be made for each port I've implemented this in a static way. As you can see below this looks relatively simple.
However, once I've started listening for data using "listen" and the callback is made, the EndReceive (I marked it below) method gets me an error:
"The I/O operation has been aborted because of either a thread exit or an application request"
I've checked for possible thread abortion, but I'm sure this isn't the case. So my question is: what causes this error?
Also, I don't see why it's necessary to pass a reference to the endpoint in the EndreceiveMethod: Isn't the callback made because data was received from a known endpoint? Does the endreceive method update the endpoint passed to the endpoint the data was actually received from (so that I can delegate this to my evenlisteners)?
I've checked MSDN docs on "EndReceive" but they don't comment on this.
Any comments or suggestions are very welomce, thanks in advance!
<br />
class LineConnection<br />
{<br />
static UdpClient receiver = new UdpClient(5048);<br />
static UdpClient sender = new UdpClient(5049);<br />
public delegate void DataReceivedDelegate(byte[] d, IPEndPoint endpoint);<br />
public static event DataReceivedDelegate DataReceived;<br />
public static bool receiving;<br />
<br />
public static void Send(byte[] b, IPEndPoint ipe)<br />
{<br />
sender.Send(b, b.Length, ipe);<br />
}<br />
<br />
public static void listen()<br />
{<br />
if (!receiving)<br />
{<br />
receiver.BeginReceive(ReceivedData, null);<br />
}<br />
}<br />
<br />
private static void ReceivedData(IAsyncResult result)<br />
{<br />
if (result.IsCompleted)<br />
{<br />
try<br />
{<br />
receiving = false;<br />
IPEndPoint end = new IPEndPoint(IPAddress.Any, 5048);<br />
<br />
byte[] b = receiver.EndReceive(result, ref end); <br />
<br />
if (DataReceived != null && b != null)<br />
DataReceived(b, end);<br />
}<br />
catch (Exception e)<br />
{<br />
Console.WriteLine("Error getting data: "<br />
+ e.ToString());<br />
}<br />
}<br />
}<br />
}<br />
|
|
|
|
|
sjembek wrote: IPEndPoint end = new IPEndPoint(IPAddress.Any, 5048);
Try:
IPEndPoint end = null;
|
|
|
|
|
No luck, unfortunately, I get the same error-message
|
|
|
|
|
Try running the receive syncronous and in another thread.
|
|
|
|
|
Yep, that's what I did, and that works. But I'd still like to know what the problem is, there's no reason this shouldn't work.
|
|
|
|
|
Hello, i am a newbie to Microsoft Communication server, I need help on development of Instant messenger using communication server API's
(i don't know is it possible or not but i heard that its possible)
(i had implemented chat programs using sockets.)
if anybody know things about this, please reply..
|
|
|
|
|
Hi to all,
How to use function "GetData(ref object DataBindings,object type, object maxlen)" of WinsockClass in Visual C#? If possible give me ex. how to call this function or what should be parameter of this function?
Best Regards & Thanks,
Aniket Salunkhe
-- modified at 5:51 Monday 26th June, 2006
|
|
|
|
|
Hi all!!
If I upload files and want to save it to a different file format, how do I do this in .NET 2.0?
What I mean is, if I upload a file called MyFile.gif, how do I specifyy how to resave it to MyFile.jpg? It's easy to go and change the extension, but when I change a .gif file to a .jpg file in my graphics editor, then it is usually redused in size.
Can any one let me know what to go and search on at Google? I tried "image manipulation .net 2.0". Nothing returns, or very little in fact.
Regards
ma se
|
|
|
|
|
May you use GDI+, using Image and save as another filet type.
|
|
|
|
|
I'm not sure what GDI is?? But I would like to keep it .NET as far as possible.
|
|
|
|
|
/*
System.Drawing.Image image = System.Drawing.Image.FromFile();
System.Drawing.Image image = System.Drawing.Image.FromStream();
image.Save("a.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
image.Save("a.gif", System.Drawing.Imaging.ImageFormat.Gif);
*/
|
|
|
|
|
Thanks, but I am a bit confused with the code. Which is the source file, and which is the destination file?
|
|
|
|
|
Two ways
1) you get the stream from Memory, by BinaryRead a little complex
2) you save the file to your hard disk first, then
get local file path and save as aonther file,
simple but unefficient.
|
|
|
|
|
GDI+ is a librabry in .NET which is used to manipulate graphics.
Read GDI+ articles from google(search GDI+ .NET)
here you can get code to generate image from another image, in this way you can craete a jpg from gif or vice versa.
Thanks
Sushant Duggal.
|
|
|
|
|
Hi,
I need to get the IP Adress (and many othe infos) of any user of my ASP.Net (web) application.
I looked arround the 'System.Web.HttpBrowserCapabilities' but there is no way to get the IP Adress.
Thanks a lot
The novice.
|
|
|
|
|
Have a look a Request.ServerVariables Collection - It definately has the user's IP Address in there plus, I suspect, the other information you are after.
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Use Request.UserHostAddress to return the client IP.
To get more info use Request.Browser
|
|
|
|
|
Hi there !
I want to store a list of System.Drawing.Rectangle objects in an ArrayList.
On action of user, the position of the Rectanlge objects should be changed.
Anyway, the collection is not updated when I use foreach in the Move function see below).
I guess the content of the arraylist is somehow protected, but what kind of dynamic list should I use instead ?
Thanks
ch
My code looks like this :
public class RectCollection
{
private ArrayList rects;
public RectCollection()
{
this.rects = new ArrayList();
}
public ArrayList Rects
{
get { return rects; }
set { rects = value; }
}
public void Add(Rectangle rect)
{
this.rects.Add(rect);
}
public void Move(int x, int y)
{
foreach (Rectangle rect in this.rects)
{
rect.Offset(x, y);
}
}
|
|
|
|
|
Its nothing to do with the list being "protected" from change - it is due to the nature of Rectangle. It is a value type, which means you effectively operate on a copy of it when calling Offset after it is unboxed from the ArrayList.
try this as your move method:
public void Move(int x, int y)
{
for(int i=0;i<this.rects.Count;i++)
{
Rectangle rect = (Rectangle)this.rects[i];
rect.Offset(x,y);
this.rects[i] = rect;
}
}
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
Hi to everyone,
I am writing a c# program that uses a native c++ dll. In the c++ dll I have a function which allocates space for a char array and returns it as follows:
char * my_func(size)<br />
{<br />
char * pOut = new char[size];<br />
...<br />
...<br />
return pOut;<br />
}
In C# part I wrapped the function as follows:
<br />
[DllImport("my_dll.dll", EntryPoint="my_func")]<br />
public static extern IntPtr my_func(int size);<br />
I am using the function in my code as follows:
<br />
IntPtr pData = my_func(nSize);<br />
byte[] arrByte = new byte[nSize];<br />
Marshal.Copy(pData, arrByte, 0, nSize);<br />
...<br />
The problem is how can I free the memory allocated in the native c++ dll by the new operator.
Thanks
|
|
|
|
|
i got this exception while calling Timer.Start()
Number must be either non-negative or -1.
Parameter name: dueTime
can any one tell me the reason.
timer interval is set to 180000.
Regards
Shajeel
|
|
|
|
|
Hi
Are the optional parameters are allowed in C#. If yes how they r implemented?
|
|
|
|
|
johnprakasht wrote: Are the optional parameters are allowed in C#.
Yes.
johnprakasht wrote: If yes how they r implemented?
It's a trick of the compiler.
Any other question?
I thought you might ask how to declare them!
with the param keyword.
As in
Console.WriteLine(string format, params object[] arguments);
|
|
|
|