如何在symfony中创建webservice [英] How to create webservice in symfony

查看:55
本文介绍了如何在symfony中创建webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在symfony创建webservice

并生成一个wsdl看起来像这样

hi
I create webservice in symfony
and it generation a wsdl look like that

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="/api/soap/check" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="CheckService" targetNamespace="/api/soap/check">
<types>
<xsd:schema targetNamespace="/api/soap/check"/>
</types>
<portType name="CheckServicePort">
<operation name="check">
<documentation>Check soap service, display name when called</documentation>
<input message="tns:checkIn"/>
<output message="tns:checkOut"/>
</operation>
</portType>
<binding name="CheckServiceBinding" type="tns:CheckServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="check">
<soap:operation soapAction="/api/soap/check#check"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="/api/soap/check"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="/api/soap/check"/>
</output>
</operation>
</binding>
<service name="CheckServiceService">
<port name="CheckServicePort" binding="tns:CheckServiceBinding">
<soap:address location="/api/soap/check"/>
</port>
</service>
<message name="checkIn">
<part name="name" type="xsd:string"/>
</message>
<message name="checkOut">
<part name="return" type="xsd:string"/>
</message>
</definitions>



我创建了一个客户


and i create a client

<?php

namespace Acme\ApiBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Zend\Soap;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

use Symfony\Component\HttpFoundation\Request;
//Template Dontrince Form Validation





//dùng cho form


class webserviceController extends Controller {

   
    public function wsAction() {

         try {
            $client = new \SoapClient('http://localhost:8000/api/soap/check?wsdl');
            $a = array('name'=>'aa');
            $response = $client->call('check', array('name' => 'Scott'));
            ladybug_dump($response->GetTrackingResult->Status);
               return new Response('<html><body>Hello '.$response .'!</body></html>');
        } catch (\SoapFault $e) {
            var_dump($e->getMessage(), $client->__getLastResponse()); die();
    }
    return array('response' => $response);
     
   
    }

}



但我没有运行请帮帮我



我尝试了什么:



i尝试创建webclient但是它没有运行plaes帮助我


but i not run please help me

What I have tried:

i try to create webclient but it not run plaes help me

推荐答案

客户端 = new \SoapClient(' http:// localhost:8000 / api / soap / check?wsdl');
client = new \SoapClient('http://localhost:8000/api/soap/check?wsdl');


a = array(' name' => ' aa');
a = array('name'=>'aa');


response =
response =


这篇关于如何在symfony中创建webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆