C# 使用SoapClient的PHP到WCF-请求实体太大
我有一个soap svc web服务,以下是我的WS方法: StoreService.svc.csC# 使用SoapClient的PHP到WCF-请求实体太大,c#,php,web-services,soap,soap-client,C#,Php,Web Services,Soap,Soap Client,我有一个soap svc web服务,以下是我的WS方法: StoreService.svc.cs namespace StoreServices { [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class StoreService : IStoreService { public bool
namespace StoreServices
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class StoreService : IStoreService
{
public bool SaveCarData(Car car)
{
//Some code
}
}
}
namespace StoreServices
{
[ServiceContract]
public interface IStoreService
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/SaveCarData", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
bool SaveCarData(Car car);
}
}
IStoreService.cs
namespace StoreServices
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class StoreService : IStoreService
{
public bool SaveCarData(Car car)
{
//Some code
}
}
}
namespace StoreServices
{
[ServiceContract]
public interface IStoreService
{
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "/SaveCarData", BodyStyle = WebMessageBodyStyle.Wrapped, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
bool SaveCarData(Car car);
}
}
在我的WS-web.config中,我已经打开了发送和接收大数据的所有缓冲区:
web.config
<system.web>
<httpRuntime targetFramework="4.0" maxRequestLength ="2147483647" executionTimeout="999999"/>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" receiveTimeout="10:00:00" closeTimeout="10:00:00"
sendTimeout="10:00:00" maxBufferPoolSize="2147483647" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" openTimeout="10:00:00" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://myDomain.pt/WStore/StoreService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="StoreServices.IStoreService"
name="BasicHttpBinding_IService" />
</client>
</system.serviceModel>
巨大的ImageBase64示例:
class Car
{
public $Id=0;
public $Name="My new car";
public $Description="";
public $ImageBase64="data:image/jpg;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7";
}
我的ImageBase64字符串示例太大,无法在此问题表单中插入。请在中插入url“”,并将其编码为base64
问题是什么?我们如何解决?我模拟了我的客户机通信来测试一些东西,我发现他正在发出http GET请求。我认为这可能是问题所在,我想把它改成HTTPPOST。如何在PHP代码中实现这一点
我也试着改变我的网络配置,但我得到了一个“SOAP-ERROR:解析WSDL:找不到…”错误。已解决!经过多次搜索和修改,我终于用一个新的web.config解决了这个问题。如何为所有与我的WS进行通信的客户机提供不是客户机端点而是服务器端点。我还需要创建一个新服务(同一个WCF项目中的svc和接口文件),并将我的web.confi更改为:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IStoreService"
receiveTimeout="10:00:00"
closeTimeout="10:00:00"
sendTimeout="10:00:00"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
openTimeout="10:00:00"/>
<binding name="BasicHttpBinding_IServiceIntegration"
receiveTimeout="10:00:00"
closeTimeout="10:00:00"
sendTimeout="10:00:00"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
openTimeout="10:00:00">
<readerQuotas
maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="StoreServices.StoreService" behaviorConfiguration="StoreServicesBehavior"/>
<service name="StoreServices.IntegrationService" behaviorConfiguration="IntegrationServicesBehavior">
<endpoint address=""
binding="basicHttpBinding"
contract="StoreServices.IIntegrationService"
bindingConfiguration="BasicHttpBinding_IServiceIntegration" />
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="StoreServicesBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="IntegrationServicesBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
<serviceActivations>
<add factory="System.ServiceModel.Activation.WebServiceHostFactory"
relativeAddress="./StoreServices/StoreService.svc"
service="StoreServices.StoreService" />
</serviceActivations>
</serviceHostingEnvironment>
</system.serviceModel>