Hi Pavel,
Thanks for your help so far, I really appreciate it!
I've mainly got this working now, but there is still an issue I need advice for. In order to get the service builder to build the service I had to include a
primaryKey="true" attribute in the
Status entity
1<entity name="Status" local-service="true" remote-service="true">
2 <column name="statusId" type="int" primary="true"/>
3 <column name="statusDescription" type="String"/>
4 <finder name="StatusId" return-type="Status">
5 <finder-column name="statusId"/>
6 </finder>
7</entity>
Here is the test method that returns some dummy values
1public Status getStatus (){
2 Status status = new StatusImpl();
3 status.setStatusDescription("status description");
4 status.setStatusId(0);
5 return status;
6 }
Here is the response from the SOAP service when called
1<?xml version="1.0" encoding="utf-8"?>
2<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
3 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5 <soapenv:Body>
6 <ns1:getStatusResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
7 xmlns:ns1="urn:http.service.mynamespace">
8 <getStatusReturn href="#id0"/>
9 </ns1:getStatusResponse>
10 <multiRef id="id0" soapenc:root="0"
11 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
12 xsi:type="ns2:StatusSoap" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
13 xmlns:ns2="http://model.mynamespace">
14 <primaryKey href="#id1"/>
15 <statusDescription xsi:type="soapenc:string">status description</statusDescription>
16 <statusId href="#id2"/>
17 </multiRef>
18 <multiRef id="id2" soapenc:root="0"
19 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int"
20 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
21 <multiRef id="id1" soapenc:root="0"
22 soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="xsd:int"
23 xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">0</multiRef>
24 </soapenv:Body>
25</soapenv:Envelope>
The addition of the primary key in the entity is causing the service to generate the multiref elements and appears to substitute my dummy value for
statusId into it, complicating the output.
If I try removing the
primaryKey="true" attribute, then I get the following exception when running
build-service1freemarker.template.TemplateModelException: Method public boolean com.liferay.portal.tools.servicebuilder.Entity.isHierarchicalTree() threw an exception when invoked on com.liferay.portal.tools.servicebuilder.Entity@9432bc12
2...
3Caused by: java.lang.RuntimeException: There is no primary key for entity Status
4...
This is why I added the primary key attribute.
Do you any way around this?
Is there a way of getting the service to build without using the primary key route I took ?
Por favor, faça login para denunciar.