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

Generated code has dependency to transport.rs from different repo #128

Open
smw-wagnerma opened this issue Apr 12, 2021 · 1 comment
Open

Comments

@smw-wagnerma
Copy link
Contributor

The generated code from a wsdl file with:

<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />

generates code like this:

pub async fn delete_authentification<T: transport::Transport>(
    transport: &T,
    request: &beatns::DeleteAuthentificationRequest
) -> Result<beatns::DeleteAuthentificationResponse, transport::Error> {
    transport::request(transport, request).await
}

with dependency to a transport module. To compile this code I have to include code from transport.rs from

https://github.com/lumeohq/onvif-rs/blob/main/schema/src/transport.rs

For better usability consider to generate a complete SOAP HTTP client for wsdl descriptions, like https://github.com/mibes404/zeep with dependencies to tokio and reqwest.

@WhyNotHugo
Copy link
Contributor

Currently this Transport type is here:

https://github.com/lumeohq/onvif-rs/blob/main/transport/src/lib.rs#L31

I think this can possible be defined as a subtype of tower::Service, which should really facilitate using this directly with hyper.

In general, there are two approaches to this issue:

  • Add a runtime dependency on a small crate which includes this Transport type and other helpers (and just import from there).
  • Include the Transport type in the generated code output.

The former requires a bit more work on the consumer side, but also makes the whole experience smoother. The latter is simpler, but an annoyance to anybody using more than one SOAP service.

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

No branches or pull requests

2 participants