Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to return array of objects with defined class #49

Open
rolandothedev opened this issue Dec 17, 2018 · 0 comments
Open

How to return array of objects with defined class #49

rolandothedev opened this issue Dec 17, 2018 · 0 comments

Comments

@rolandothedev
Copy link

I have the following method signature I want to meet:

DetailedInfoResponse[] userInfo (String secretKey, DetailedInfoRequest[] requests)

Both DetailedInfoResponse and DetailedInfoRequest are objects that have their own properties. With the current syntax, how can I define the class?;

I've tried the following and it works but the type is generalized to "ns:ArrayOfRequests".

     * @WebMethod
     * @WebParam(param="object[] $requests { int $correlationNumber string $token }",header=false)
     * @WebParam(param="string $secretKey",header=false)
     * @WebResult(param="object[] $reponse{ int $correlationNumber string $userId }")

WSDL output:

<definitions name="RGS" targetNamespace="/"><types><xsd:schema targetNamespace="https://rgs.com"><xsd:complexType name="ArrayOfRequests"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="ns:Request[]"/></xsd:restriction></xsd:complexContent></xsd:complexType><xsd:element name="Request" nillable="true" type="ns:Request"/><xsd:complexType name="Request"><xsd:sequence><xsd:element name="correlationNumber" type="xsd:int"/><xsd:element name="token" type="xsd:string"/></xsd:sequence></xsd:complexType><xsd:complexType name="ArrayOfReponse"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="ns:Reponse[]"/></xsd:restriction></xsd:complexContent></xsd:complexType><xsd:element name="Reponse" nillable="true" type="ns:Reponse"/><xsd:complexType name="Reponse"><xsd:sequence><xsd:element name="correlationNumber" type="xsd:int"/><xsd:element name="userId" type="xsd:string"/></xsd:sequence></xsd:complexType></xsd:schema></types><message name="userInfoRequest"><part name="requests" type="ns:ArrayOfRequests"/><part name="secretKey" type="xsd:string"/></message><message name="userInfoResponse"><part name="reponse" type="ns:ArrayOfReponse"/></message><portType name="RGSPortType"><operation name="userInfo"><input message="tns:userInfoRequest"/><output message="tns:userInfoResponse"/></operation></portType><binding name="RGSBinding" type="tns:RGSPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="userInfo"><soap:operation soapAction="//#userInfo"/><input><soap:body use="literal" namespace="/"/></input><output><soap:body use="literal" namespace="/"/></output></operation></binding><service name="RGSService"><port name="RGSPort" binding="tns:RGSBinding"><soap:address location="/soap-server"/></port></service></definitions>

If I do the following then the definitions of UserInfoRequest and UserInfoResponse are excluded however the types are as I expect them.

     * @WebMethod
     * @WebParam(param="UserInfoRequest[] $requests { int $correlationNumber string $token }",header=false)
     * @WebParam(param="string $secretKey",header=false)
     * @WebResult(param="UserInfoResponse[] $reponse{ int $correlationNumber string $userId }")

WSDL output:

<definitions name="RGS" targetNamespace="/"><types><xsd:schema targetNamespace="https://rgs.com"><xsd:complexType name="ArrayOfRequests"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="xsd:UserInfoRequest[]"/></xsd:restriction></xsd:complexContent></xsd:complexType><xsd:complexType name="ArrayOfReponse"><xsd:complexContent><xsd:restriction base="soapenc:Array"><xsd:attribute ref="soapenc:arrayType" soap:arrayType="xsd:UserInfoResponse[]"/></xsd:restriction></xsd:complexContent></xsd:complexType></xsd:schema></types><message name="userInfoRequest"><part name="requests" type="ns:ArrayOfRequests"/><part name="secretKey" type="xsd:string"/></message><message name="userInfoResponse"><part name="reponse" type="ns:ArrayOfReponse"/></message><portType name="RGSPortType"><operation name="userInfo"><input message="tns:userInfoRequest"/><output message="tns:userInfoResponse"/></operation></portType><binding name="RGSBinding" type="tns:RGSPortType"><soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/><operation name="userInfo"><soap:operation soapAction="//#userInfo"/><input><soap:body use="literal" namespace="/"/></input><output><soap:body use="literal" namespace="/"/></output></operation></binding><service name="RGSService"><port name="RGSPort" binding="tns:RGSBinding"><soap:address location="/soap-server"/></port></service></definitions>

I tried looking in the documentation and unit test but could not find anything.
Thanks in advance for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant