在java服务器上托管的c#中调用Web服务并传递XML.zip文件的Byte [] [英] Calling web service in c# hosted on java server and passing Byte[] of XML.zip file
问题描述
我正在使用所得税印度E-的Java服务器上托管的网络服务(我认为如此)提交(服务手册),这是服务网址,该服务在java中正常运行但是在.Net中使用它会抛出异常。我正在路过:
1.UserID(字符串),
2.Pass(字符串),
3.证书链(字符串)
4.Signature(字符串)
5.Xml zip文件(byte [])
这会引发异常请提供zip文件。
我用Google搜索并发现:
1. Endianness :Java将内部存储为Big Endian,而.NET默认为Little Endian。
2. 签名:C#字节是无符号的。 Java字节已签名。因此,在服务器端可能无法识别zip文件的byte []。
我的代码如下:
I am using a web service hosted on Java server(i think so) of Income tax India E-Filing (Service manual) ,Here's service url , the service works properly in java but using it with .Net it throws exception. I am passing:
1.UserID(string),
2.Pass(string),
3.Certificate chain(string)
4.Signature(string)
5.Xml zip file(byte[])
This throws exception "Please provide zip file".
I googled hard and find that:
1. Endianness: Java stores things internally as Big Endian, while .NET is Little Endian by default.
2. Signedness: C# bytes are unsigned. Java bytes are signed.So the byte[] of zip file may not be recognized at server-side.
My code is given below:
DITWSAuthInfo authInfo = new DITWSAuthInfo();
authInfo.userID = "######";
authInfo.password = "######";
authInfo.certChain = "######";
authInfo.signature = "######";
string filePath = @"D:\Created XML\abc.zip";
byte[] byteArray = File.ReadAllBytes(filePath);
itrservice.submitITRRequest obj = new submitITRRequest();
obj.DITWSAuthInfoEle = authInfo;
obj.itrXMLFile = byteArray;
var res = uploadXML.submitITR(obj);
String TokenNumber = res.DITWSResponseEle.result;
MessageBox.Show(TokenNumber);
抛出错误
请提供一个zip文件
你能帮我上传xml zip文件吗?
提前致谢
This throws error
please provide a zip file
Can you please help me to upload xml zip file?
Thanks in advance
推荐答案
嘿Kalpesh,
我也面临同样的问题。你找到了解决办法。
你可以帮助我,因为我被卡住了.....
Hey Kalpesh,
I am also facing same problem.Have you found any solution.
Can you please help me since i am stuck.....
这篇关于在java服务器上托管的c#中调用Web服务并传递XML.zip文件的Byte []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!