c# - PHP to WCF with SoapClient - Request Entity Too Large -


i have soap svc web service , these ws methods:

storeservice.svc.cs

namespace storeservices {     [aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequirementsmode.allowed)]     public class storeservice : istoreservice     {         public bool savecardata(car car)         {             //some code         }     } } 

istoreservice.cs

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);     } } 

in ws web.config turned buffers send , receive big data:

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> 

my client call service this:

<?php  ini_set('default_socket_timeout', 360000);  class car {   public $id=0;   public $name="my new car";   public $description="";   public $imagebase64=""; }   $car_toinsert = new car(); $requestparams = array('car' => $car_toinsert);  try {     $time_start = microtime(true);      $client = new soapclient('http://mydomain.pt/wstore/storeservice.svc?wsdl',          array('encoding'=>'iso-8859-1', 'keep_alive' => true,             'trace' => 1,             'exceptions'=> 1,             'connection_timeout'=> 3600));      $response = $client->savecardata($requestparams);        print_r($response);  } catch (exception $e) {     $time_request = (microtime(true)-$time_start);     if(ini_get('default_socket_timeout') < $time_request) {         //timeout error!         print_r("request time bigger");     } else {         //other error         //$error = $e->getmessage();         print_r($e->getmessage());     } }  ?> 

my client turned on "buffers" said in here.

now problem is: when client send "short" car.imagebase64 string works fine, when car.imagebase64 string huge can communicate ws , error: request entity large

short imagebase64 example:

class car {   public $id=0;   public $name="my new car";   public $description="";   public $imagebase64="data:image/jpg;base64,r0lgodlheaaqamqaaorhhovskudfoulrsop3woydzu6qdvcchpgolfo0o/xbs/fnwfjz0frl3/zy7////waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaach5bakaabaalaaaaaaqabaaaavvicsozglcqaosj6mu7fiyzekqnktoqgdsm8hbadguxogaiqhsvp5qanqkgiguhwfuylcvdfcrkue1lbavavifidltimbkc5gm2hb0slbcbmqib0ujiqa7"; } 

huge imagebase64 example:

my imagebase64 string example big insert in question form. please insert url "http://d3eaqdewfg2crq.cloudfront.net/wp-content/uploads/carousel/main-reporting/report.png" in here , encode base64.

what problem , how can solve this? have simulated client communication test things , figured out making http request. think can problem , want change http post. how can in php code?

error php request headers

i tried change web config this got "soap-error: parsing wsdl: couldn't find...” error.

solved! after many search , modifications solved problem new web.config changing. how have not client endpoints server endpoints clients communicates ws. needed create new service (svc , interface files in same wcf project) , change web.confi this:

<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> 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -