locked
vb.net vb SOAP/WSDL API I'm stuck RRS feed

  • Question

  • User488491262 posted

    Hi,

    I'm stuck. I've been re-reading up on SOAP/WSDL's all last week but not making much headway. I would areally appreciate any help.

    I have a WSDL service reference/proxy class installed in in my project. I can see it all in my object browser. the wsdl is loacated at:

    https://www.estes-express.com/tools/...teService?wsdl

    I've constructed the call to the webservice below but am getting an error "InnerException: {"The type Estes_Test.wsdl_estes.FullCommodityType was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically."}"

    Herein lies my problem.    I am uncertain on how to construct the "fullcommodities " type  to FullCommodityType().

    The "commodity" is a load of 7000 pounds, class 60 freight and a quantity of 6 palletts. Since im requesting a volume load quote from Estes freightlines I have to use the "FullCommoditiesType" as opposed to the "BaseCommoditiesType" as dictated in the documentation
    (https://www.estes-express.com/resour...b-service-v4-0). There can be up to 5 commodities loaded so I'm assuming it can/should be a array. I'll be happy just to get the one load rated.  

    FullCommoditiesType.commodity As Estes_Test.wsdl_estes.FullCommodityType()

    The public class FullCommodityType has the public properties of class, ClassSpecified, description, peices, pieceType
    weight, pieceType as wsdl_estes.packagngType, dimensions as wsdl_estes.DimensionsType

    I can't seem to get my head wrapped around how to construct the Commodites to pass them into the request. By looking at the object browser I'm pretty sure they have to be added to the "quoteRequest.Item".

    Can someone offer some assitance on this. Been strugeling with it for days.

    Thanks


    Dim EstesService As ratingPortTypeClient = New ratingPortTypeClient()
    
    		Dim quoteResponse As rateQuote = New rateQuote
    
    		Dim quoteRequest As rateRequest = New rateRequest
    
    		Dim estesAuth As New wsdl_estes.AuthenticationType With {
    		.user = ("myestes"),
    		.password = ("estesPW")
    		}
     
    		Dim shipfrom As New wsdl_estes.PointType With {
    		.city = ("Memphis"),
    		.stateProvince = ("TN"),
    		.postalCode = ("38104"),
    		.countryCode = ("US")
    		}
    
    		Dim shipto As New wsdl_estes.PointType With {
    		.city = ("Atlanta"),
    		.stateProvince = ("GA"),
    		.postalCode = ("30369"),
    		.countryCode = ("US")
    		}
    
    
    		Dim loaddimensions As New wsdl_estes.DimensionsType With {
    		.length = ("48"),
    		.width = ("44"),
    		.height = ("55")
    		}
    
    		Dim myFreightLoad As New wsdl_estes.FullCommodityType With {
    		.class = (60),
    		.classSpecified = True,
    		.description = ("Books"),
    		.pieces = ("6"),
    		.pieceType = PackagingType.SK,
    		.weight = ("7000"),
    		.dimensions = loaddimensions
    		}
    
    
    		Dim quoteRequest As rateRequest = New rateRequest With {
    		.account = ("7451400"),
    		.terms = ("P"),
    		.linearFeet = ("12"),
    		.stackable = YesNoBlankType.N,
    		.payor = ("T"),
    		.originPoint = shipfrom,
    		.destinationPoint = shipto,
    		.Item = myFreightLoad
    		}
    
    
                 ' The actual call for consuming the webservice is
    
    		quoteResponse = EstesService.getQuote(estesAuth, quoteRequest)
    Monday, July 27, 2020 5:26 PM

All replies

  • User-943250815 posted

    I did not dive deep into, but, created a webservice reference on my side just to know a little bit more.
    I suggest you take a look at XSD files generated, and search for "FullCommodityType", seems it does not use all properties you see on Intellisense, I mean in particular properties "class" and "classSpecified".

    My guess is just create "FullCommodityType" with proper type (ShipmentClassType as in XSD) )in "class" propery and do not use "classSpecified"

    For "FullCommoditiesType", I think you can use a List or Array of "FullCommodityType"

    Hope this might help you in some way

    Tuesday, July 28, 2020 1:37 AM
  • User488491262 posted

    Thank You JZero for responding. This is the 4th forum I've posted on and after 100's of reads the first response ( CodeProject, Stackoverflow, and VBforums.net) Although I did have one stating he couldnt be of help. 

    I'm in a remote  1 deep position and am really stuck on this and would really like some help or a shove in the right direction.

    I have created a fullcomodityType object   

    	Dim fgtarray(4) As FullCommodityType
    
    
    		fgtarray(0) = New FullCommodityType With {
    		.class = (60),
    		.classSpecified = True,
    		.description = ("Books"),
    		.pieces = ("6"),
    		.pieceType = PackagingType.SK,
    		.weight = ("7000"),
    		.dimensions = loaddimensions
    			}

    Problem is, in the "RateRequest"  itself  there is no method oo load the FullCommoditiesType. There is an "Item()" Object which originally I assumed was how you pass the coomodities in. 

    I agree FullCommodityType would be an array and should go into FullCommoditiesType.commodity  and have done it:

    	Dim fgtarray(4) As FullCommodityType
    
    
    		fgtarray(0) = New FullCommodityType With {
    		.class = (60),
    		.classSpecified = True,
    		.description = ("Books"),
    		.pieces = ("6"),
    		.pieceType = PackagingType.SK,
    		.weight = ("7000"),
    		.dimensions = loaddimensions
    			}
    
    
    		Dim myload As FullCommoditiesType = New FullCommoditiesType With {
    		.commodity = (fgtarray)
    		}
    
    
    
    		Dim quoteRequest As rateRequest = New rateRequest With {
    		.account = ("7451400"),
    		.terms = ("P"),
    		.linearFeet = ("12"),
    		.stackable = YesNoBlankType.N,
    		.payor = ("T"),
    		.originPoint = shipfrom,
    		.destinationPoint = shipto,
    		.Item = myload
    		}
    
    
    	Try
    			quoteResponse = EstesService.getQuote(estesAuth, quoteRequest)
    		Catch ex As Exception
    			Dim ermsg As String = ex.Message
    
    		End Try
    
    
    



    I can';t seem to find where the raterequest  FullCommoditiesType   attaches to the request.

    I am getting a different error now.   "Schema validation error"   

    Tuesday, July 28, 2020 7:41 PM
  • User-943250815 posted

    I just proposed you step back and do not fill all properties of FullCommodityType.
    So take a look on XSD files on same folder of your WebReference, there you will see that FullCommodityType do not expect all class properties.
    Check XSD files to confirm what I mention in last post and give a try to see at least if can communicate with WS without local errors

    Wednesday, July 29, 2020 1:18 AM
  • User488491262 posted

    Hi Jzero,  

    I did look at the xsd file  and have dropped the classSpecified. For some reason it shows up in the Oject Viewer. 
    The xsd file dosen't show classSpecified as you have mentioned. 

    xsd img

    I still get the schema validation error but i just noticed that the  FullCommoditiesType  expects a "List" rather than an "Array"
    I'll go back in in a few and try the list and see what happens.  

    Thanks again for your help.  

    Wednesday, July 29, 2020 5:50 PM
  • User488491262 posted

    Still no success. May just outsource this pieceI'm first going to re-contact the carrier.  Something is  amiss.

    Thank You 

    Friday, August 7, 2020 6:46 PM