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

The property 'address' is not defined for this Trash #11

Open
ayb opened this issue Aug 9, 2012 · 37 comments
Open

The property 'address' is not defined for this Trash #11

ayb opened this issue Aug 9, 2012 · 37 comments

Comments

@ayb
Copy link

ayb commented Aug 9, 2012

Running into a similar issue to another that has been reported but different property (and newer version of the WSDL)

This is happening when I run the Stamps.create! action. Here is the output I am getting:

SOAP request: https://swsim.testing.stamps.com/swsim/SwsimV23.asmx
SoapAction: http://stamps.com/xml/namespace/2012/04/swsim/swsimv23/AuthenticateUser, Content-Type: 
text/xml;charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:tns="http://stamps.com/xml/namespace/2012/04/swsim/swsimv23"
 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><tns:AuthenticateUser>
 <tns:Credentials><tns:IntegrationID>[MY-INTEGRATION-ID-HERE]</tns:IntegrationID><tns:Username>[MY
 -USERNAME-HERE]</tns:Username><tns:Password>[MY-PASSWORD-HERE]</tns:Password>
 </tns:Credentials></tns:AuthenticateUser></soap:Body></soap:Envelope>

SOAP response (status 200):

 <?xml version="1.0" encoding="utf-8"?><soap:Envelope
  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
  instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><AuthenticateUserResponse
  xmlns="http://stamps.com/xml/namespace/2012/04/swsim/swsimv23">
 <Authenticator>exp=1344609632&amp;uid=2799981&amp;cty=swsim&amp;
 ctk=AAuJ3tJa7M5ALfsNktPX99CJOoM=&amp;iid=6LKmNRnJxEyDQfY5lUwNVw==
 &amp;rsid=0&amp;eac=0&amp;eacx=0&amp;rrsid=0&amp;raid=0&amp;resellerid=0
 &amp;pexp=0&amp;mac=Yf9kPx+hNYoX5po8vIOrCbHWgaQ=</Authenticator>
 <LastLoginTime>2012-08-09T14:38:58.12</LastLoginTime><ClearCredential>false</ClearCredential>
 <LoginBannerText /><PasswordExpired>false</PasswordExpired></AuthenticateUserResponse></soap:Body>
 </soap:Envelope>

NoMethodError: The property 'address' is not defined for this Trash.
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/trash.rb:50:in property_exists?' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/trash.rb:35:in[]='
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/dash.rb:83:in block in initialize' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/dash.rb:82:ineach_pair'
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/dash.rb:82:in initialize' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/stamps-0.3.0/lib/stamps/mapping.rb:126:innew'
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/stamps-0.3.0/lib/stamps/mapping.rb:126:in to=' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/trash.rb:34:in[]='
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/dash.rb:83:in block in initialize' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/dash.rb:82:ineach_pair'
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/hashie-1.0.0/lib/hashie/dash.rb:82:in initialize' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/stamps-0.3.0/lib/stamps/client/stamp.rb:32:innew'
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/stamps-0.3.0/lib/stamps/client/stamp.rb:32:in create!' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/stamps-0.3.0/lib/stamps.rb:25:inmethod_missing'
from (irb):28
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/railties-3.1.7/lib/rails/commands/console.rb:45:in start' from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/railties-3.1.7/lib/rails/commands/console.rb:8:instart'
from /Users/ayb/.rvm/gems/ruby-1.9.2-p290@stack/gems/railties-3.1.7/lib/rails/commands.rb:40:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'>>

@ayb
Copy link
Author

ayb commented Aug 9, 2012

I went through some code and thought I could resolve it by simply making a minor tweak and using standardized_address[:address] instead:

 stamp = Stamps.create!(
     :tracking_number => true,
     :rate          => rates.first,
     :to            => standardized_address[:address],
     :from => {
     :full_name   => 'Littlelines',
     :address1    => '50 Chestnut Street',
     :address2    => 'Suite 234',
     :city        => 'Beavervcreek',
     :state       => 'OH',
     :zip_code    => '45440'
   },
   :memo => 'Thanks for shopping with us!'
)

But now I am running into a different error:

 {:errors=>["Invalid SOAP message due to XML Schema validation failure. The element 'CreateIndicium' in namespace 'http://stamps.com/xml/namespace/2012/04/swsim/swsimv23' has invalid child element 'TrackingNumber' in namespace 'http://stamps.com/xml/namespace/2012/04/swsim/swsimv23'. List of possible elements expected: 'IntegratorTxID' in namespace 'http://stamps.com/xml/namespace/2012/04/swsim/swsimv23'."], :valid?=>false}

Guessing they have made some changes to the API between v12 and the current v23?

@mattsears
Copy link
Owner

Have you tried setting the endpoint to v12? Like this:

config.endpoint = "https://swsim.testing.stamps.com/swsim/swsimv12.asmx"

(Within the configure block)

@git-odi
Copy link

git-odi commented Sep 13, 2012

We are getting the same error using any/all versions including 12. We are able to standardize and address and perform a get rates, but when we try to create a label with that information, it blows up on us giving us the same error as above. Thoughts?

@mattsears
Copy link
Owner

Can you post your config (omit sensitive values)?

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

I am having the same problem. I can assist as well. I'm guessing that the wsdl is out of date and we need to update the data in types.rb.

I can provide you with the latest wsdl, reflecting v24, not v12.

@mattsears
Copy link
Owner

From what I understand, the error also occurs with v12 of the wsdl?

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

I cannot test v12 for some reason. I have a brand new stamps.com integration_id and it seems I only have access to v24. When I change to v12, I get a login error.

@git-odi
Copy link

git-odi commented Sep 13, 2012

Here is my current setup:

Stamps.configure do |config|
    config.integration_id = 'ID'
    config.username       = 'USERNAME'
    config.password       = 'PASSWORD'
    config.raise_errors   = true
    config.endpoint       = 'https://swsim.testing.stamps.com/swsim/swsimv12.asmx'
  end
    from_address = Stamps.clean_address(
      :address => {
        :full_name => 'Chipotle',
        :address1  => '801 Congress Avenue',
        :city      => 'Austin',
        :state     => 'TX',
        :zip_code  => '78701'
    })
    
    to_address = Stamps.clean_address(
      :address => {
        :full_name   => 'Freebirds',
        :address1    => '515 South Congress Avenue',
        :city        => 'Austin',
        :state       => 'TX',
        :zip_code    => '78704'
    })
  
    # send one burrito
    rates = Stamps.get_rates(
      :from_zip_code => '78701',
      :to_zip_code   => '78704',
      :weight_lb     => '0.5',
      :ship_date     => '2012-09-14'
    )
  
    stamp = Stamps.create!(
        :tracking_number  => true,
        :rate             => rates.first,
        :to               => to_address[:address],
        :from             => from_address[:address],
        :memo             => 'Thanks for shopping with us!'
    )

Here is the error I get:

(soap:Client) Invalid SOAP message due to XML Schema validation failure. The element 'CreateIndicium' in namespace 'http://stamps.com/xml/namespace/2010/11/swsim/swsimv12' has invalid child element 'TrackingNumber' in namespace 'http://stamps.com/xml/namespace/2010/11/swsim/swsimv12'. List of possible elements expected: 'IntegratorTxID' in namespace 'http://stamps.com/xml/namespace/2010/11/swsim/swsimv12'.

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

ok, so I've updated my code to reflect the same format as darnavo's Stamps.create method and here is my response, converted to yaml format:


:errors:

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

If I comment out the tracking_number = true, here is the error I get:

<script src="https://gist.github.com/3717971.js"> </script>

@git-odi
Copy link

git-odi commented Sep 13, 2012

what error ^^ ?

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

sorry, here it is...

---
:errors:
- !ruby/string
  str: ! 'Invalid SOAP message due to XML Schema validation failure. The element ''CreateIndicium''
    in namespace ''http://stamps.com/xml/namespace/2012/05/swsim/swsimv24'' has invalid
    child element ''Rate'' in namespace ''http://stamps.com/xml/namespace/2012/05/swsim/swsimv24''.
    List of possible elements expected: ''IntegratorTxID'' in namespace ''http://stamps.com/xml/namespace/2012/05/swsim/swsimv24''.'
  attributes: {}
:valid?: false

@git-odi
Copy link

git-odi commented Sep 13, 2012

yes, same thing for me as well.

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

When I comment out the "Rate" attribute, I get an error complaining about the "From" field.

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

I don't know if it helps, but my only guess is that you are using outdated wsdl data or something is up with mapping.rb. If I was more experienced with wsdl and soap technology, I would be of better help.

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

I have found a ruby gem called wasabi that can consume a wsdl file. It may be worthwhile using something like that so that we can add an option to load up a wsdl file for the corresponding version of the namespace and endpoint URL's

I was able to load up the stamps.com wsdl using wasabi successfully, in addition to being able to see the output of the wsdl in yaml format using the .to_yaml call (requiring the yaml gem).

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

I've tried modifying request.rb to use the wsdl file and I still get the same error. Here is my modification:

    def request(web_method, params, raw=false)
      client = Savon::Client.new do |wsdl, http|
        #wsdl.endpoint = self.endpoint
        #wsdl.namespace = self.namespace
        wsdl.document = "swsimv24.wsdl"
      end

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

I contacted stamps.com support and this was their feedback:


You are not including the "IntegratorTxID" in your CreateIndicium request. That element would go just prior to TrackingNumber and is a unique identifier you create.

@mr-rick
Copy link

mr-rick commented Sep 13, 2012

Ok, so I added a transaction_id

puts "creating stamp"
stamp = Stamps.create!(
    :transaction_id => 'blah',
    :memo => 'Thanks for shopping with us!',
    :tracking_number => true,
    :rate          => rates.first,
    :to            => to_address[:address],
    :from          => from_address[:address]
)


and hear is the new output in yaml format:
```yaml
---
:errors:
- !ruby/string
  str: ! 'Deprecated Method Input:  Web method deprecated for this specific use from
    interface version [22] onwards'
  attributes: {}
:valid?: false

@git-odi
Copy link

git-odi commented Sep 13, 2012

So I added transaction_id to Stamps.create! in the configuration I pasted above:


stamp = Stamps.create!(
    :transaction_id   => "193193",
    :tracking_number  => true,
    :rate             => rates.first,
    :to               => to_address[:address],
    :from             => from_address[:address],
    :memo             => 'Thanks for shopping with us!'
)

and now I get this error message:

(soap:Server) Memo is not supported for First Class Mail with Letter or Postcard.

Which means it may have worked, but I may be requesting an unsupported service. I will play around a bit more.

@mr-rick
Copy link

mr-rick commented Sep 14, 2012

Ok, I've got it working I believe with the right :service_type

puts "getting rate quote"
rates = Stamps.get_rates(
  :from_zip_code => '90291',
  :to_zip_code   => '20500',
  :weight_lb     => '0.5',
  :service_type  => "US-PP",
  :ship_date     => '2012-09-14'
)
puts "creating stamp"
stamp = Stamps.create!(
    :transaction_id => 'blah',
    :tracking_number => true,
    :rate          => rates.first,
    :to            => to_address[:address],
    :from          => from_address[:address]
)

Here is the output in yaml format, which I think is something I have to get stamps.com to fix:
```yaml
creating stamp
---
:errors:
- !ruby/string
  str: Insufficient Postage
  attributes: {}
:valid?: false

@mattsears
Copy link
Owner

Nice, indeed it looks like it is working. What did you do to get around the "The property 'address' is not defined" error?

@mr-rick
Copy link

mr-rick commented Sep 14, 2012

To get around the "The property 'address' is not defined", I had to use the below format, where to_address and from_address are return values from the Stamps.clean_address call.

Here is what I'm using in the Stamps.create! call:

:to            => to_address[:address],
:from          => from_address[:address]

@mr-rick
Copy link

mr-rick commented Sep 14, 2012

I don't know if it's making a difference, but I'm not using self.endpoint and self.namespace anymore. I'm loading the full wsdl file when invoking/instantiating Savon::Client.new... I'm setting wsdl.document to the location of the wsdl on my server.

@mr-rick
Copy link

mr-rick commented Sep 14, 2012

No, it does not matter. When I remove the code to load the wsdl and revert back to using self.endpoint and self.namespace, it works fine. So it appears we don't need to load the full wsdl at this point.

@mattsears
Copy link
Owner

You shouldn't have to run the :from address through Stamps.clean_address. Do you know if you just use the Stamps.clean_address on the :to address will it work?

@mr-rick
Copy link

mr-rick commented Sep 14, 2012

I did that originally from your documentation. I imagine that what ever object is returned by from_address[:address] call seems to be what works. All you'd need to do is figure out what object is returned form that and recreate the format, and I'm sure you wouldn't need to clean the from address.

@mattsears
Copy link
Owner

I see. Thanks for your help with this.

@mr-rick
Copy link

mr-rick commented Sep 14, 2012

How do I use AddOnV2??

I want to add this addon to a get rate call: US-A-DC

US-A-DC is a delivery confirmation addon.

Thanks!

On Thu, Sep 13, 2012 at 7:07 PM, Matt Sears [email protected]:

I see. Thanks for your help with this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-8549899.

@mattsears
Copy link
Owner

Add ons go in the :rate hash of the stamp. Something like this....

stamp = Stamps.create!({
    :sample          => true,
    :transaction_id  => "1234567890ABCDEFG",
    :tracking_number => true,
    :rotation        => 90,
    :rate          => {
      :from_zip_code => '45440',
      :to_zip_code   => '45458',
      :weight_oz     => '1.8',
      :ship_date     => Date.today.strftime('%Y-%m-%d'),
      :package_type  => 'Package',
      :service_type  => 'US-FC',
      :cod_value     => 10.00,
      :add_ons       => {
        :add_on => [
          { :type => 'US-A-COD' },
          { :type => 'US-A-DC' }
        ]
      }
    }
 ...

@mark-d-holmberg
Copy link

How do you deal with the 'Insufficient Postage' error?

@mattsears
Copy link
Owner

@mark-d-holmberg That usually means you need to add funds to your stamps.com account.

@mark-d-holmberg
Copy link

@mattsears Thank you. I am now trying to do the service type of 'US-PM' for US priority mail, but when I call the create! method I get the following error back

Untrackable label is not supported for priority mail class.

Any ideas?

@mr-rick
Copy link

mr-rick commented Nov 29, 2012

you have to add either signature confirmation or delivery confirmation to
priority mail. you get tracking numbers for either one of these services.

On Thu, Nov 29, 2012 at 9:02 AM, Mark Holmberg [email protected]:

@mattsears https://github.com/mattsears Thank you. I am now trying to
do the service type of 'US-PM' for US priority mail, but when I call the
create! method I get the following error back

Untrackable label is not supported for priority mail class.

Any ideas?


Reply to this email directly or view it on GitHubhttps://github.com//issues/11#issuecomment-10856514.

@puzzell
Copy link

puzzell commented May 9, 2013

i tried providing signature confirmation or delivery confirmation to priority mail but still same error.......... "Untrackable label is not supported for priority mail class." Any fixes? Could it be bug at their end because till yesterday it was working fine..

@commodity
Copy link

@mr-rick How did you go about fixing the error:
Savon::SOAP::Fault: (soap:Server) Deprecated Method Input: Web method deprecated for this specific use from interface version [22] onwards

I'm running into the same problem. Thanks!

@Amitdada
Copy link

Deprecated Method Input: Web method deprecated for this specific use from interface version [22] onwards in asp.net c# while printing shipping label so what i have to do now?
image

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

8 participants