A*******n 发帖数: 625 | 1 web service 我做的不多, 一般情况下我用“Add Service Reference", 在address
里面输入web service 的URL, 找到service,在code里面就可以使用。 我现在输入“
https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/“, 得到下面的message:
There was an error downloading 'https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/'.
The request failed with the error message: |
S***k 发帖数: 370 | |
a9 发帖数: 21638 | 3 你应该输入wsdl还是啥的那个url吧。
address
'.
be
ercot
content
solution
Error
【在 A*******n 的大作中提到】 : web service 我做的不多, 一般情况下我用“Add Service Reference", 在address : 里面输入web service 的URL, 找到service,在code里面就可以使用。 我现在输入“ : https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/“, 得到下面的message: : There was an error downloading 'https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/'. : The request failed with the error message:
|
A*******n 发帖数: 625 | 4 加了也没用。
他们的做法是去他们的网站下载需要的wsdl和xsd files。 用svcutil 建一个cs和一个
config 文件, 然后在写function。
他们说function最后送出去的format like below:
?xml version="1.0" encoding="UTF-8"?>
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
http://docs.oasis-open.org/wss/2004/....................................>
.........................
.........
RequestMessage这部分我可以用他们产生的那个cs来建立,可是“”
这部分他们说用 standard WCF coding。
有谁做过他们家的project, 和web service有关的?跪求 |
a9 发帖数: 21638 | 5 实在不行直接手动组xml得了。估计你也没几个参数
我记得很久以前做过这东西,现在忘的差不多了。大概是给生成的cs文件里加一堆[]的
属性后来搞出来了。当然不是搞的你这个东西,是另外的一个。
【在 A*******n 的大作中提到】 : 加了也没用。 : 他们的做法是去他们的网站下载需要的wsdl和xsd files。 用svcutil 建一个cs和一个 : config 文件, 然后在写function。 : 他们说function最后送出去的format like below: : ?xml version="1.0" encoding="UTF-8"?> : : xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" : xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> : :
|
c*********e 发帖数: 16335 | 6 还在用soap啊,現在都restful了。
address
'.
【在 A*******n 的大作中提到】 : web service 我做的不多, 一般情况下我用“Add Service Reference", 在address : 里面输入web service 的URL, 找到service,在code里面就可以使用。 我现在输入“ : https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/“, 得到下面的message: : There was an error downloading 'https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/'. : The request failed with the error message:
|
A*******n 发帖数: 625 | 7 你找人借东西,人家说你给我一元RMB我就借你, 你说别人家都要美金了?
没办法啊老大,人家用什么我们就用什么啊。
【在 c*********e 的大作中提到】 : 还在用soap啊,現在都restful了。 : : address : '.
|
A*******n 发帖数: 625 | 8 直接手动组xml?更鸡毛,直接给 500 internal error。 |
a9 发帖数: 21638 | 9 那显然是你组的不对,呵呵。
【在 A*******n 的大作中提到】 : 直接手动组xml?更鸡毛,直接给 500 internal error。
|
A*******n 发帖数: 625 | 10 我就是用对方给我的sample request。 没理由不对,具体的参数可能不对,但是
format我想没问题。 |
k**n 发帖数: 3989 | 11 那是纯soap, 你得拿对方的schema文件, 用svcutilty生成proxy 本地代码. 具体忘了.
的确很难用. 还不如回信骂他们一顿, 什么破公司,还在用15年前的技术, 连web
service wsdl都搞不定. 说不定他们就给你新api 了.
address
'.
【在 A*******n 的大作中提到】 : web service 我做的不多, 一般情况下我用“Add Service Reference", 在address : 里面输入web service 的URL, 找到service,在code里面就可以使用。 我现在输入“ : https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/“, 得到下面的message: : There was an error downloading 'https://xxxxxx.com/2007-08/Nodal/eEDS/EWS/'. : The request failed with the error message:
|
A*******n 发帖数: 625 | 12 呵呵, 他们sample code都不给,你还指望他们给你新api? 你们知道什么是 primary
signature吗? 我现在的error是the primary signature must be encrypted。
我现在的function可以送request, 用fiddler我也可以看到response, 可是用他们的
proxy得到reponse就出错。我想是不是我的setting不对。
EndpointAddress ea = new EndpointAddress("https://misapi.ercot.
com/2007-08/Nodal/eEDS/EWS/");
System.ServiceModel.Channels.CustomBinding custombinding = new
System.ServiceModel.Channels.CustomBinding();
System.ServiceModel.Channels.AsymmetricSecurityBindingElement
sbe = System.ServiceModel.Channels.AsymmetricSecurityBindingElement.
CreateMutualCertificateDuplexBindingElement(MessageSecurityVersion.
WSSecurity11WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPol
icy11BasicSecurityProfile10);
sbe.SecurityHeaderLayout = System.ServiceModel.Channels.
SecurityHeaderLayout.Strict;
sbe.IncludeTimestamp = false;
sbe.SetKeyDerivation(false);
sbe.LocalClientSettings.MaxClockSkew = new TimeSpan (0,3,0);
sbe.LocalClientSettings.ReplayWindow = new TimeSpan(0, 2, 0);
sbe.LocalClientSettings.ReplayCacheSize = 10000;
sbe.LocalServiceSettings.MaxClockSkew = new TimeSpan(0, 3, 0);
sbe.AllowSerializedSigningTokenOnReply = true;
sbe.RequireSignatureConfirmation = false;
System.ServiceModel.Channels.HttpsTransportBindingElement
transport = new System.ServiceModel.Channels.HttpsTransportBindingElement();
custombinding.Elements.Add(sbe);
custombinding.Elements.Add(new System.ServiceModel.Channels.
TextMessageEncodingBindingElement(System.ServiceModel.Channels.
MessageVersion.Soap11, System.Text.Encoding.UTF8));
custombinding.Elements.Add(transport);
OperationsClient client = new OperationsClient(custombinding,ea);
//client certificate
System.Security.Cryptography.X509Certificates.X509Certificate2
ercotcert = new System.Security.Cryptography.X509Certificates.
X509Certificate2("C:\ESettlement\ESettlementConsole\albertqse2014.pfx","xxx"
);
client.ClientCredentials.ClientCertificate.Certificate =
ercotcert;
//server certificate
System.Security.Cryptography.X509Certificates.X509Certificate2
ercotservicecert = new System.Security.Cryptography.X509Certificates.
X509Certificate2("C:\ESettlement\ESettlementConsole\misapi.ercot.com public
key.cer");
client.ClientCredentials.ServiceCertificate.DefaultCertificate =
ercotservicecert;
client.Open();
DateTime dt = DateTime.Now.AddDays(-1);
RequestMessage RM = new RequestMessage();
RequestType rt = new RequestType();
HeaderType ht = new HeaderType();
rt.StartTime = new DateTime(dt.Year,dt.Month,dt.Day,0,0,0,0);
rt.StartTimeSpecified = true;
rt.EndTime = new DateTime(dt.Year, dt.Month, dt.Day, 23, 59, 59,
999);
rt.EndTimeSpecified = true;
rt.Option = "11113";//Real Time Market Consolidated Operating
Day Extract
rt.OperatingDate = DateTime.Now;
ht.UserID = "API_xxxx";
ht.Verb = HeaderTypeVerb.get;
ht.Noun = "Reports";
AttributedDateTime adt = new AttributedDateTime();
EncodedString es = new EncodedString();
Random r = new Random();
es.Value = r.Next().ToString();
adt.Value = DateTime.Now.ToString("s");
ReplayDetectionType rdt = new ReplayDetectionType();
rdt.Created = adt;
rdt.Nonce = es;
ht.ReplayDetection = rdt;
ht.Revision = "001";
ht.Source = "7800613002000";
//ht.MessageID = "151451";
RM.Header = ht;
RM.Request = rt;
XmlSerializer ser = new XmlSerializer(RM.GetType());
StringWriter sw = new StringWriter();
ser.Serialize(sw, RM);
string xml = sw.ToString();
try
{
ResponseMessage responsemessage = client.MarketInfo(RM);
}
catch (Exception ex)
{
//client.Close();
} |
A*******n 发帖数: 625 | |
c*********e 发帖数: 16335 | 14 8天才解决问题,这在我们公司要被赶走了。
【在 A*******n 的大作中提到】 : 总算告一段落,谢谢各位
|