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 replace xpath variables in http:put or post #416

Closed
chokdee opened this Issue Jun 16, 2018 · 7 comments

Comments

Projects
None yet
3 participants
@chokdee

chokdee commented Jun 16, 2018

Hi

I can't find any documentation or example about replacing variables in resource file with http:PUT

This here is working but not useable for mem because we have many endpoints

<send endpoint="restService">
  <message>
     <resource file="templates/mytemplate.xml"/>
     <element path="//somenode/id" value="${myid}"/>
  </message>
</send>

The following doesn't work or I don't know how to do it

<http:send-request  client="restService">
  <http:PUT path="${pathWithVars}">
     <http:headers>
        <http:header name="X-MY" value="123"/>
     </http:headers>
     <http:body>
        <http:resource file="templates/mytemplate.xml"/>
        need x path here
     </http:body>
  </http:PUT>
</http:send-request>

Any help?

@chokdee

This comment has been minimized.

Show comment
Hide comment
@chokdee

chokdee Jun 16, 2018

If I change the citrus-http-testcase.xsd in citrus file with the element tag that is used in the second part is working ;-)
Shall I provide a fix for that?

chokdee commented Jun 16, 2018

If I change the citrus-http-testcase.xsd in citrus file with the element tag that is used in the second part is working ;-)
Shall I provide a fix for that?

@christophd

This comment has been minimized.

Show comment
Hide comment
@christophd

christophd Jun 18, 2018

Member

Manipulating message body templates with Xpath might be verbose as you need to find each element in the XML with a separate expression in order to overwrite.

I would suggest to use ${myid} variable reference directly in the template file. Citrus is able to resolve the variables directly in the body templates. Wouldn't that be more comfortable than using lots of Xpath expressions?

Member

christophd commented Jun 18, 2018

Manipulating message body templates with Xpath might be verbose as you need to find each element in the XML with a separate expression in order to overwrite.

I would suggest to use ${myid} variable reference directly in the template file. Citrus is able to resolve the variables directly in the body templates. Wouldn't that be more comfortable than using lots of Xpath expressions?

@chokdee

This comment has been minimized.

Show comment
Hide comment
@chokdee

chokdee Jun 18, 2018

Maybe, but I'm converting 2000 test cases and I can't rewrite tons of xpath entries and templates

chokdee commented Jun 18, 2018

Maybe, but I'm converting 2000 test cases and I can't rewrite tons of xpath entries and templates

@chokdee

This comment has been minimized.

Show comment
Hide comment
@chokdee

chokdee Jul 10, 2018

I have provided a Pull Request with the changed XSD

chokdee commented Jul 10, 2018

I have provided a Pull Request with the changed XSD

@svettwer

This comment has been minimized.

Show comment
Hide comment
@svettwer

svettwer Jul 20, 2018

Member

Hi @chokdee!

Unfortunately I can't find your PR. I see #432 that you proposed but this is concerning a different issue afaics.

Member

svettwer commented Jul 20, 2018

Hi @chokdee!

Unfortunately I can't find your PR. I see #432 that you proposed but this is concerning a different issue afaics.

@svettwer

This comment has been minimized.

Show comment
Hide comment
@svettwer

svettwer Jul 24, 2018

Member

PR concerning this issue: #432

Member

svettwer commented Jul 24, 2018

PR concerning this issue: #432

@svettwer

This comment has been minimized.

Show comment
Hide comment
@svettwer

svettwer Sep 7, 2018

Member

Hi!

Thx for your contribution.
The changes have been merged into master.

BR,
Sven

Member

svettwer commented Sep 7, 2018

Hi!

Thx for your contribution.
The changes have been merged into master.

BR,
Sven

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment