使用Chronopost Web服务.
在Web浏览器中使用此发布的HTTP请求时(帐号和密码隐藏在那里,因此除非您拥有Chronopost ID,否则无法自行测试):
https://ws.chronopost.fr/shipping-cxf/ShippingServiceWS/shippingWithReservationAndESDWithRefClientPC?subAccount=000&accountNumber=ACCOUNT_NUMBER&password=PASSWORD&shipperCivility=E&shipperName=DELBET&shipperName2=RICHARD&shipperAdress1=1%20rue%20des%20accents&shipperZipCode=28500&shipperCity=Ste%20Gemme%20Moronval&shipperCountry=FR&shipperCountryName=France&shipperContactName=Richard%20Delbet&shipperEmail=richard.delbet@telintrans.fr&shipperPhone=0123456789&shipperMobilePhone=0601020304&recipientCivility=E&recipientName=MALKA&recipientName2=DAVID&recipientAdress1=1%20rue%20des%20essais&recipientZipCode=75001&recipientCity=Paris&recipientCountry=FR&recipientCountryName=France&recipientContactName=David%20Malka&recipientEmail=david.malka@telintrans.fr&recipientPhone=0222426789&recipientMobilePhone=0622220304&shipperRef=CMD1&recipientRef=ART1&productCode=01&shipDate=27/07/2010%2010:00:00&shipHour=10&weight=2&service=0&objectType=MAR&modeRetour=1&mode=PDF
我对所有正确的数据都有一个有效的响应.
使用具有完全相同参数的SoapClient时:
$client = new \SoapClient("http://ws.chronopost.fr/shipping-cxf/ShippingServiceWS?wsdl");
$data = [
'subAccount' => '000',
'accountNumber' => ACCOUNT_NUMBER,
'password' => PASSWORD,
'shipperCivility' => 'E',
'shipperName' => 'DELBET',
'shipperName2' => 'RICHARD',
'shipperAdress1' => '1%20rue%20des%20accents',
'shipperZipCode' => '28500',
'shipperCity' => 'Ste%20Gemme%20Moronval',
'shipperCountry' => 'FR',
'shipperCountryName' => 'France',
'shipperContactName' => 'Richard%20Delbet',
'shipperEmail' => 'richard.delbet@telintrans.fr',
'shipperPhone' => '0123456789',
'shipperMobilePhone' => '0601020304',
'recipientCivility' => 'E',
'recipientName' => 'MALKA',
'recipientName2' => 'DAVID',
'recipientAdress1' => '1%20rue%20des%20essais',
'recipientZipCode' => '75001',
'recipientCity' => 'Paris',
'recipientCountry' => 'FR',
'recipientCountryName' => 'France',
'recipientContactName' => 'David%20Malka',
'recipientEmail' => 'david.malka@telintrans.fr',
'recipientPhone' => '0222426789',
'recipientMobilePhone' => '0622220304',
'shipperRef' => 'CMD1',
'recipientRef' => 'ART1',
'productCode' => '01',
'shipDate' => '27/07/2010%2010:00:00',
'shipHour' => '10',
'weight' => '2',
'service' => '0',
'objectType' => 'MAR',
'modeRetour' => '1',
'mode' => 'PDF',
];
$response = $client->__soapCall("shippingWithReservationAndESDWithRefClientPC", array($data));
object(stdClass)#531 (1) { [“return”]=> object(stdClass)#537 (2) {
[“errorCode”]=>
int(1)
[“errorMessage”]=>
string(3112) ” fr.chronopost.soap.shipping.exception.ValidateException at
fr.chronopost.soap.shipping.util.PopulateUtils.populateSkybill(PopulateUtils.java:355)
at
fr.chronopost.soap.shipping.cxf.ShippingServiceWS.shippingWithReservationAndESDWithRefClientPC(ShippingServiceWS.java:615)
at sun.reflect.GeneratedMethodAccessor1258.invoke(UnkNown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:136)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:82)
at
org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:54)
at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:68)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:56)
at
org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at
org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:92)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
at
org.apache.cxf.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
at
org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:285)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:168)
at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:175)
at
org.apache.cxf.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)
at
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
at
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:744) ” } }
一个人可能无法直接帮助我了解Chronopost Web服务,但也许我在PHP SoapClient对象中遗漏了一些东西.
使用Web浏览器时为什么我有正确的响应?使用SoapClient时出现某种ValidateException错误?
解决方法:
进行SOAP调用时,您不需要包含URL编码的数据字符串. PHP soapclient自动将数据编码为XML.因此问题很可能是服务对您的数据执行的验证,并且它在%字符上窒息.尝试改变
'shipDate' => '27/07/2010%2010:00:00'
至
'shipDate' => '27/07/2010 10:00:00'
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。