문제

I'm consuming a SOAP web service from Apex that salesforce's SOAP stack doesn't support, so I'm treating it as XML over HTTP.

I have XML Schema values, such as the dateTime 2008-03-30T00:00:00-05:00 that I need to unmarshall into Apex. Is there built-in support, or a library available that can do this?

도움이 되었습니까?

해결책

There is no easy solution for this, as you probably tried right away, the Datetime.valueOf() is of little help here, you will have to dissect the string and compose base Datetime using the 6-params newInstanceGmt static method, then call addHours/addMinutesto compensate the time zone.

Even if we neglect the governor (and I suspect you'll easily run into it if you have a large set with lots of dates), other primitive types will also require special handling, then you'll have a set of predefined derived types, and to top it all custom derived types with facets. And then mix it all together to get complex types. And when you are all done with all this you'll have a custom SOAP stack in Apex :) How can I convince you not to do that :)

I had similar problems, but I did not even want to entertain the idea of building a custom SOAP stack (I already had huge problems with JSON library and governor limiter). The solution I used is to install an ASMX "proxy" on company's server close to the source (though it does not have to be MS tech, you can equally build a same proxy with, say, Axis) which would consume the WSDL in full force and repack operations into baby food that salesforce SOAP could digest. Even with the lag of piggybacking of another web service it was still way better than nothing.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top