Code Monkey home page Code Monkey logo

Comments (7)

rhelms avatar rhelms commented on August 30, 2024

Almost done with the work, however, I've noticed something slightly odd.

Consider the method being parsed:

/**
 * getAuthors
 *
 * @desc Get all authors
 * @return wrapper[] $authors @className=\App\Soap\Author
 */
public function getAuthors() {
    $request = new Request('authors/index');
    $response = new Response();
    $controller = new AuthorsController($request, $response);
    $controller->setAction('index');
    $controller->invokeAction();
    $authors = array();
    foreach ($controller->viewVars['authors'] as $author) {
        $obj = new Author();
        $obj->id = $author->id;
        $obj->name = $author->name;
        $obj->created = $author->created;
        $obj->modified = $author->modified;
        $authors[] = $obj;
    }
    return $authors;
}

This method works fine for rpc/literal and rpc/encoded. However, when converting to document/literal wrapped, the return needs to be a wrapper object, this becoming:

/**
 * getAuthors
 *
 * @desc Get all authors
 * @return wrapper[] $authors @className=\App\Soap\Author
 */
public function getAuthors() {
    $request = new Request('authors/index');
    $response = new Response();
    $controller = new AuthorsController($request, $response);
    $controller->setAction('index');
    $controller->invokeAction();
    $authors = array();
    foreach ($controller->viewVars['authors'] as $author) {
        $obj = new Author();
        $obj->id = $author->id;
        $obj->name = $author->name;
        $obj->created = $author->created;
        $obj->modified = $author->modified;
        $authors[] = $obj;
    }
            $getAuthorsResponse = new \stdClass();
            $getAuthorsResponse->authors = $authors;
    return $getAuthorsResponse;
}

Now, since our returning data in matching the document/literal WSDL, the SOAPServer will be fine, but our @return phpDoc no longer matches the data.

Technically, it should be

/**
 * @return object $getAuthorResponse @(wrapper[] $authors @className=\App\Soap\Author)
 */

or this, if we explicitly define a class for the return type

/**
 * @return wrapper $getAuthorResponse @className=\App\Soap\GetAuthorResponse
 */

However, if you do this, then further changes need to made to DocumentLiteralWrapped, to anticipate the correct naming conventions when using wrapped document/literal. i.e. the @return will already have Response in the variable name, and will refer to the appropriate class names.

from wsdl-creator.

piotrooo avatar piotrooo commented on August 30, 2024

Sorry for my delay in answering, in Poland we have only 8 a.m :)

  1. Child Elements of "Part" Element Type will be SEI Method parameter (Unsure)

I think this point is done, because every element has his own sequence.

<xsd:complexType name="User">
   <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element name="age" type="xsd:int"/>
      <xsd:element name="payment" type="xsd:double"/>
   </xsd:sequence>
</xsd:complexType>
  1. Input Wrapper Element name should match with Operation name (Fail)

I'm not exactly get it, what is the meaning of this point?

  1. = + "Response" (Fail)

I think this is not a bug. Look at explanation of this point:

The name of the output wrapper element could be (but doesn't have to be) the operation name
appended with "Response"

What is your proposition for this as you say odd behaviour?

from wsdl-creator.

rhelms avatar rhelms commented on August 30, 2024

With regards to Input Wrapper Element name should match with Operation name (Fail), if the operation is getAuthors, then the wrapper element should also be called getAuthors. Currently, it would generate getAuthorsRequestParameters, and you would need to have a method called getAuthorsRequestParameters on your class handler.

Sorry for the next line. The original text had < and >, and they got swallowed. I updated the original post, but I guess that didn't make it in the email.

However, I guess it doesn't have to be getAuthorsResponse, but I think that looks neater than getAuthorsResponseParameters.

I don't have a proposition for the odd behaviour. It should be handled correctly, so that the @return matches the actual return type. Other languages probably have injected code where they can automatically convert the return value, and wrap it accordingly, however, I'm not sure if that is possible with PHP without providing a class that all class handlers should extend. I might actually try implementing a DocumentLiteralWrappedHelper that class handlers can use to automatically wrap the response.

I was going to see what your preference would be.

from wsdl-creator.

piotrooo avatar piotrooo commented on August 30, 2024

This odd behaviour is fine for me. This will be some specify case for php.

from wsdl-creator.

piotrooo avatar piotrooo commented on August 30, 2024

Closed by pull request #16

from wsdl-creator.

piotrooo avatar piotrooo commented on August 30, 2024

In this weekend or next week I try to test all functionalities which you commit.
And if all thinks will be OK, I make a realease.

from wsdl-creator.

rhelms avatar rhelms commented on August 30, 2024

Good idea. The next bit I'll be looking at is generating structured faults in the WSDL. But that might take a bit longer to do.

from wsdl-creator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.