0

We are using wso2 microservice engine as middleware between WSO2 EI and DB. The target chain MQ->WSO EI->msf4j->DB. DTO which is transfered - formatted xml string which basically shouldn't be parsed till msf4j layer. So, for all this is just string. Sometimes this is a big string.

Our code

@Path("/accountdao")
public class AccountDaoService implements Microservice {

@POST
@Path("/getbyparam")
@Produces(MediaType.TEXT_PLAIN)
public String getAllAccounts(@QueryParam("commandText") String commandText) {

Previously we tested it in GET's style calls, I mean smth like

URL url = new URL(serverURL + requestURL + "/?commandText=" + 
URLEncoder.encode(request,"UTF-8"));

Cause in all other styles, using let's say HttpClient from commons, we didn't receive data in commandText.

And I've found, that I don't know how to pass large data using SoapUI or just clear java client..

With small text blocks(like 200-300 chars) is all ok, but with 6k lenght this is already problem.

Is it possible to handle in msf4j large strings or we should use for it smth else?

thanks.

ps probably we should use @FormParam & multipart/form-data?

UPDATE 1

 <payloadFactory media-type="xml">
                <format>
                    <uri.var.commandText xmlns="">$1</uri.var.commandText>
                </format>
                <args>
                    <arg evaluator="xml" expression="get-property('uri.var.commandText')"/>
                </args>
            </payloadFactory>
            <call blocking="true" description="">
                <endpoint key="microserviceEP"/>
            </call>

and microservice code

    @POST
    @Path("/getclientcontract")
    @Produces(MediaType.TEXT_PLAIN)
    public String getClientContract(@Context Request request) {

List<ByteBuffer> fullMessageBody = request.getFullMessageBody();
        StringBuilder sb = new StringBuilder();
        for (ByteBuffer byteBuffer : fullMessageBody) {
            sb.append(StandardCharsets.UTF_8.decode(byteBuffer).toString());
        }

        String commandText = sb.toString();

is it ok, or there is possible more correct way?

PVN
  • 21
  • 6

0 Answers0