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

Exclude attributes on query? #25

Open
stim371 opened this issue Aug 29, 2015 · 1 comment
Open

Exclude attributes on query? #25

stim371 opened this issue Aug 29, 2015 · 1 comment

Comments

@stim371
Copy link

stim371 commented Aug 29, 2015

I am working off of WSDL 68 and am getting errors when trying to find an Amendment record. This seems to be because all fields in the WSDL are being sent, even when they are not available for the Query type.

However fields like DestinationAccountId are considered invalid for queries.

SOAP request: https://apisandbox.zuora.com/apps/services/a/68.0
SOAPAction: "query", Content-Type: application/soap+xml;charset=UTF-8, Content-Length: 1144
<?xml version="1.0" encoding="UTF-8"?><env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zns="http://api.zuora.com/" xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ins0="http://object.api.zuora.com/" xmlns:ins1="http://fault.api.zuora.com/"><env:Header><env:SessionHeader><ins0:Session>session_token</ins0:Session></env:SessionHeader></env:Header><env:Body><zns:query><zns:queryString>select AutoRenew, Code, ContractEffectiveDate, CreatedById, CreatedDate, CustomerAcceptanceDate, Description, DestinationInvoiceOwnerId, EffectiveDate, InitialTerm, Name, RatePlanData, RenewalSetting, RenewalTerm, ServiceActivationDate, Status, SubscriptionId, TermStartDate, TermType, Type, UpdatedById, UpdatedDate, Id from Amendment where Id = 'abc123'</zns:queryString></zns:query></env:Body></env:Envelope>

resulting in

Zuora::Fault: (fns:INVALID_FIELD) invalid field for query: Amendment.DestinationInvoiceOwnerId

Is there a way to specify that certain fields are not sent for different action types? I'm just commenting them out of the WSDL currently.

@stevendaniels
Copy link

I ran into similar issues and ended up monkey-patching Zuora::SoapConnector#query.

Here's an example where I filtered out custom fields from queries.

module Zuora
  class SoapConnector
    def query(sql)
      Zuora::Api.instance.request(:query) do |xml|
        xml.__send__(@model.zns, :queryString, sql.gsub(/ [^,.]*__c,/, ''))
      end
    end
  end
end

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

2 participants